Files
Eww_Widgets/eww/sidebar/eww.yuck
T
2023-04-24 15:41:27 +05:45

156 lines
6.5 KiB
Plaintext
Executable File

;; ** Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defpoll hour :interval "1s" `date +%I`)
(defpoll minute :interval "1m" `date +%M\%p`)
(defpoll fulldate :interval "24h" "date '+%A, %d %B'")
(defvar pfpimage "../images/pp.png")
(defpoll iam :interval "6h" `whoami`)
(defpoll weathericon :interval "2h" "~/.config/eww/sidebar/scripts/Weather icon")
(defpoll weathercity :interval "2h" "~/.config/eww/sidebar/scripts/Weather city")
(defpoll weathertemp :interval "2h" "~/.config/eww/sidebar/scripts/Weather current_temp")
(defpoll weatherfeel :interval "2h" "~/.config/eww/sidebar/scripts/Weather feels_like")
(defpoll weatherdesc :interval "2h" "~/.config/eww/sidebar/scripts/Weather weather_desc")
(defpoll weatherhex :interval "2h" "~/.config/eww/sidebar/scripts/Weather hex")
(defpoll title :interval "0s" "~/.config/eww/sidebar/scripts/music title")
(defpoll artist :interval "0s" "~/.config/eww/sidebar/scripts/music artist")
(defpoll album :interval "0s" "~/.config/eww/sidebar/scripts/music album")
(defpoll playpause :interval "0s" "~/.config/eww/sidebar/scripts/music statusicon")
(defpoll art :interval "0s" "~/.config/eww/sidebar/scripts/music coverloc")
;; ** Widgets ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; User info Widget ;;
(defwidget pfp[]
(box :orientation "h" :class "pfpbox" :space-evenly false
(box :orientation "v" :height 100 :class "profilebox" :hexpand true :space-evenly false
(box :orientation "h" :class "pfpboxtop" :space-evenly false
(box :class "pfpface" :halign "start" :hexpand false
(image :path "${pfpimage}" :image-width 75 :image-height 75))
(box :orientation "v" :class "pfpboxbot" :space-evenly false
(box :class "welcometxt" :halign "start" :valign "center" "Welcome ${iam}")
(box :class "pfpapps" :halign "center" :valign "center" :hexpand true :spacing 20
(button :class "launcher-btn"
:onclick "google-chrome-stable & disown"
:tooltip "Google-Chrome"
"󰊯")
(button :class "launcher-btn"
:onclick "github-desktop"
:tooltip "Sys Fetch"
"󰊤")
(button :class "launcher-btn"
:onclick "thunar ~ & disown"
:tooltip "Thunar"
"󰉋")
(button :class "launcher-btn"
:onclick "Term --ot"
:tooltip "Terminal"
"󰞷")
(button :class "launcher-btn"
:onclick "subl & disown"
:tooltip "Editor"
"󰅴"))
))
)
)
)
;; Weather widget ;;
(defwidget weather[]
(box :orientation "h" :class "weatherfullbox" :space-evenly false
(box :orientation "v" :height 100 :class "weatherbox" :hexpand true :space-evenly false
(box :orientation "h" :class "weathertop" :space-evenly false
(box :class "weatherdesc" :style "color: ${weatherhex};" :halign "start" :hexpand true weatherdesc)
(box :class "weathertemp" :halign "end" "${weathertemp}°C")
)
(box :orientation "h" :class "weatherbot" :space-evenly false
(box :class "weathercity" :halign "start" :hexpand true weathercity)
(box :class "weathercity" :halign "end" "Feels like ${weatherfeel}°C")
)
)
(box :class "weathericon" :style "color: ${weatherhex};" :halign "center" weathericon)
)
)
;; Music Player Widget ;;
(defwidget musicplayer[]
(box :orientation "h" :class "playerfullbox" :space-evenly false
(box :orientation "v" :height 100 :class "playerbox" :hexpand true :space-evenly false
(box :orientation "h" :class "playertop" :space-evenly false :spacing 15
(box :class "album_art" :style "background-image: url('${art}');")
(box :class "playerinfo":orientation "v" :halign "center" :hexpand true
(label :class "song" :limit-width 18 :text title)
(label :class "artist" :limit-width 18 :text artist)
(box :orientation "h" :class "playerbot" :space-evenly false :valign "center" :halign "center" :spacing 30
(button :class "btn_prev" :onclick "~/.config/eww/scripts/sidebar/music previous" "玲")
(button :class "btn_play" :onclick "~/.config/eww/sidebar/scripts/music toggle" playpause)
(button :class "btn_next" :onclick "~/.config/eww/sidebar/scripts/music next" "怜")
)
)
)
)
)
)
;; System info Widget ;;
(defwidget sysinfo[]
(box :orientation "h" :class "sysfullbox" :space-evenly false
(box :orientation "v" :height 100 :class "sysbox" :hexpand true :space-evenly false
(box :orientation "v" :class "systop" :space-evenly false :spacing 15
(box :class "stats" :hexpand "false" :vexpand "false" :space-evenly "false"
(label :tooltip "${round(EWW_CPU.avg, 0)}%" :class "stats-icon-cpu" :text "")
(scale :min 0 :max 101 :active false :value {EWW_CPU.avg} :class "scale-cpu" :width 265)
)
(box :class "stats" :hexpand "false" :vexpand "false" :space-evenly "false"
(label :tooltip "${round(EWW_RAM.used_mem_perc, 0)}%" :class "stats-icon-ram" :text "﬙")
(scale :min 0 :max 101 :active false :value {EWW_RAM.used_mem_perc} :class "scale-ram" :width 265)
)
(box :class "stats" :hexpand "false" :vexpand "false" :space-evenly "false"
(label :tooltip "${round(EWW_DISK["/"].used_perc, 0)}%" :class "stats-icon-fs" :text "")
(scale :min 0 :max 101 :active false :value {(EWW_DISK["/"].used / EWW_DISK["/"].total) * 100} :class "scale-fs" :width 265)
)
)
)
)
)
;; The Time Widget ;;
(defwidget infotime[]
(box :halign "center" :class "caltime" :orientation "h" :space-evenly false
(box :class "caltext" "${hour}")
(box :class "caltimeboxes" :valign "center" :spacing 5 :space-evenly false :orientation 'v'
(box :class "caltimebox magenta" "󰝤")
(box :class "caltimebox green" "󰝤")
(box :class "caltimebox blue" "󰝤")
)
(box :class "caltext" "${minute}")
)
)
;; Panel Widget ;;
(defwidget ipanel[]
(box :orientation "v" :width 360 :space-evenly false :class "calouterbox"
(infotime)
(box :class "infodate" "${fulldate}")
(pfp)
(weather)
(musicplayer)
(sysinfo)
)
)
;; ** Windows ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defwindow dashboard
:geometry (geometry :x "0.2%"
:y "49.5px"
:anchor "left top")
:stacking "fg"
(ipanel))