nixos-config/nixos/home/desktop/hyprland/eww/dashboard/eww.yuck

171 lines
8.3 KiB
Plaintext

;; **
;; ** Widgets config for EWW
;; ** Created by : @adi1090x
;; ** Converted by : @tripleo1
;; **
;; ** Variables ***********************************************************************
;; Profile vars
(defvar IMAGE "images/profile.jpg")
(defvar NAME "kogami")
(defpoll UNAME :interval "5m" `whoami`)
;; System vars
(defpoll HOST :interval "5s" `hostname`)
(defpoll CPU_USAGE :interval "1s" `sys_info --cpu`)
(defpoll MEM_USAGE :interval "1s" `sys_info --mem`)
(defpoll BLIGHT :interval "1s" `echo $(( ($(brightnessctl g) * 100 + $(brightnessctl m) / 2) / $(brightnessctl m) ))`)
(defpoll BATTERY :interval "5s" `battery-hyprlock -p`)
;; Time vars
(defpoll HOUR :interval "5s" `date +\"%H\"`)
(defpoll MIN :interval "5s" `date +\"%M\"`)
(defpoll DAY :interval "5s" `date +\"%A\"`)
;; Uptime vars
(defpoll UPHOUR :interval "5s" `uptime -p | sed 's/,//g' | awk '{print $6, $7}'`)
(defpoll UPMIN :interval "5s" `uptime -p | sed 's/,//g' | awk '{print $8, $9}'`)
;; Music vars
(defpoll SONG :interval "1s" `playerctl-hyprlock --title`)
(defpoll ARTIST :interval "1s" `playerctl-hyprlock --artist`)
(defpoll STATUS :interval "1s" `playerctl-hyprlock --status`)
(defpoll COVER :interval "1s" `playerctl-hyprlock --cover`)
(defpoll CURRENT :interval "1s" `echo "scale=2; $(playerctl metadata --format "{{ position }}") / $(playerctl metadata --format "{{ mpris:length }}") * 100" | bc`)
(defpoll CTIME :interval "1s" `playerctl metadata --format "{{ duration(position) }}"`)
(defpoll TTIME :interval "1s" `playerctl metadata --format "{{ duration(mpris:length) }}"`)
;; Files vars
(defpoll FREE :interval "5s" `df -h / | awk '{print $4}' | tail -n 1 | sed 's/G/GB/'`)
;; ** Widgets *************************************************************************
;; background
(defwidget bg []
(box :class "bg")
)
;; profile
(defwidget user []
(box :class "genwin" :orientation "v" :spacing 35 :space-evenly "false" :vexpand "false" :hexpand "false"
(box :style "background-image: url('${IMAGE}');" :class "face" :halign "center")
(label :class "fullname" :halign "center" :wrap "true" :limit-width 25 :text NAME)
(label :class "username" :halign "center" :wrap "true" :limit-width 25 :text UNAME)))
;; system
(defwidget system []
(box :class "genwin" :vexpand "false" :hexpand "false"
(box :orientation "v" :spacing 35 :halign "center" :valign "center" :space-evenly "false" :vexpand "false" :hexpand "false"
(box :class "cpu_bar" :orientation "h" :spacing 20 :space-evenly "false" :vexpand "false" :hexpand "false"
(label :class "iconcpu" :text "󰍛 ")
(scale :min 0 :max 100 :value CPU_USAGE :active "false"))
(box :class "mem_bar" :orientation "h" :spacing 20 :space-evenly "false" :vexpand "false" :hexpand "false"
(label :class "iconmem" :text " ")
(scale :min 0 :max 100 :value MEM_USAGE :active "false"))
(box :class "bright_bar" :orientation "h" :spacing 20 :space-evenly "false" :vexpand "false" :hexpand "false"
(label :class "iconbright" :text " ")
(scale :min 0 :max 100 :value BLIGHT :active "false"))
(box :class "bat_bar" :orientation "h" :spacing 20 :space-evenly "false" :vexpand "false" :hexpand "false"
(label :class "iconbat" :text " ")
(scale :min 0 :max 100 :value BATTERY :active "false")))))
;; clock
(defwidget clock []
(box :class "genwin" :orientation "h" :spacing 50 :space-evenly false :vexpand "false" :hexpand "false"
(box :orientation "h" :spacing 0
(label :class "time_hour" :valign "start" :wrap "true" :limit-width 25 :text HOUR)
(label :class "time_min" :valign "end" :wrap "true" :limit-width 25 :text MIN))
(box :orientation "v" :spacing 0
(label :class "time_day" :valign "end" :halign "end" :wrap "true" :limit-width 25 :text DAY))))
;; uptime
(defwidget uptime []
(box :class "genwin"
(box :orientation "h" :halign "center" :spacing 40 :space-evenly "false" :vexpand "false" :hexpand "false"
(label :class "icontimer" :valign "center" :text "󱎫 ")
(box :orientation "v" :valign "center" :spacing 0 :space-evenly "false" :vexpand "false" :hexpand "false"
(label :class "uphour" :halign "start" :wrap "true" :limit-width 25 :text UPHOUR)
(label :class "upmin" :halign "start" :wrap "true" :limit-width 25 :text UPMIN)))))
;; Music
(defwidget music []
(box :class "genwin" :orientation "h" :space-evenly "false" :vexpand "false" :hexpand "false"
(box :class "album_art" :vexpand "false" :hexpand "false" :style "background-image: url('${COVER}');")
(box :orientation "v" :spacing 20 :space-evenly "false" :vexpand "false" :hexpand "false"
(label :halign "center" :class "song" :wrap "true" :limit-width 20 :text SONG)
(label :halign "center" :class "artist" :wrap "true" :limit-width 15 :text ARTIST)
(box :orientation "h" :spacing 20 :halign "center" :space-evenly "true" :vexpand "false" :hexpand "false"
(button :class "btn_prev" :onclick "playerctl previous" "")
(button :class "btn_play" :onclick "playerctl play-pause" STATUS)
(button :class "btn_next" :onclick "playerctl next" ""))
(box :class "music_bar" :halign "center" :vexpand "false" :hexpand "false"
(scale :onscroll "playerctl position 1+" :min 0 :active "true" :max 100 :value CURRENT)))))
;; folders
(defwidget folders []
(box :class "genwin" :orientation "v" :space-evenly "false" :vexpand "false" :hexpand "false"
(box :class "hddbox" :orientation "h" :space-evenly "false" :vexpand "false" :hexpand "false"
(box :space-evenly "false" :vexpand "false" :hexpand "false"
(button :class "hddicon" :onclick "scripts/open_apps --fm" " ")
(label :class "fs_sep" :text "|"))
(box :space-evenly "false" :vexpand "false" :hexpand "false"
(label :class "hdd_label" :wrap "true" :limit-width 25 :text FREE)))
(box :orientation "h" :space-evenly "false" :vexpand "false" :hexpand "false"
(button :class "iconfolder1" :onclick "scripts/open_folders --docs" "󰉋 ")
(button :class "label_folder1" :onclick "scripts/open_folders --docs" "Documents"))
(box :orientation "h" :space-evenly "false" :vexpand "false" :hexpand "false"
(button :class "iconfolder2" :onclick "scripts/open_folders --dl" "󰉍 ")
(button :class "label_folder2" :onclick "scripts/open_folders --dl" "Downloads"))
(box :orientation "h" :space-evenly "false" :vexpand "false" :hexpand "false"
(button :class "iconfolder3" :onclick "scripts/open_folders --music" "󱍙 ")
(button :class "label_folder3" :onclick "scripts/open_folders --music" "Music"))
(box :orientation "h" :space-evenly "false" :vexpand "false" :hexpand "false"
(button :class "iconfolder4" :onclick "scripts/open_folders --pics" " 󰉏 ")
(button :class "label_folder4" :onclick "scripts/open_folders --pics" "Pictures"))
(box :orientation "h" :space-evenly "false" :vexpand "false" :hexpand "false"
(button :class "iconfolder5" :onclick "scripts/open_folders --cfg" "󰚝 ")
(button :class "label_folder5" :onclick "scripts/open_folders --cfg" "~/.config"))
(box :orientation "h" :space-evenly "false" :vexpand "false" :hexpand "false"
(button :class "iconfolder6" :onclick "scripts/open_folders --local" "󰚝 ")
(button :class "label_folder6" :onclick "scripts/open_folders --local" "~/.local"))))
;; ** Windows *************************************************************************
;; background
(defwindow background :stacking "fg" :focusable "false" :monitor 0
:geometry (geometry :x 0 :y 0 :width "1920px" :height "1080px")
(bg))
;; profile
(defwindow profile :stacking "fg" :focusable "false" :monitor 0
:geometry (geometry :x 150 :y 150 :width 350 :height 440)
(user))
;; system
(defwindow system :stacking "fg" :focusable "false" :monitor 0
:geometry (geometry :x 150 :y 605 :width 350 :height 325)
(system))
;; clock
(defwindow clock :stacking "fg" :focusable "false" :monitor 0
:geometry (geometry :x 515 :y 150 :width 350 :height 155)
(clock))
;; uptime
(defwindow uptime :stacking "fg" :focusable "false" :monitor 0
:geometry (geometry :x 515 :y 320 :width 350 :height 155)
(uptime))
;; music
(defwindow music :stacking "fg" :focusable "false" :monitor 0
:geometry (geometry :x 515 :y 490 :width 610 :height 280)
(music))
;; folders
(defwindow folders :stacking "fg" :focusable "false" :monitor 0
:geometry (geometry :x 1445 :y 490 :width 325 :height 440)
(folders))