infrastructure/nixos/hosts/thalassa/null/home/eww/eww.yuck
2022-09-24 16:19:37 +02:00

165 lines
4.1 KiB
Plaintext

(defwidget bar []
(centerbox
:orientation "v"
(box
:valign "start"
:hexpand false
:vexpand false
:orientation "v"
:space-evenly false
)
(workspaces
:halign "center"
:vexpand true
:hexpand false
:orientation "v"
)
(box :valign "end" :hexpand false :vexpand true :orientation "v" :space-evenly false
(wifi)
(do-not-disturb)
(volume)
(battery)
(time)
)
)
)
;; ━━━ BATTERY ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
(defwidget battery []
(eventbox :onclick "eww open batterywindow --toggle"
(label
:text `${
EWW_BATTERY.BAT0.status == "Charging" ? "" :
EWW_BATTERY.BAT0.capacity < 10 ? "" :
EWW_BATTERY.BAT0.capacity < 20 ? "" :
EWW_BATTERY.BAT0.capacity < 30 ? "" :
EWW_BATTERY.BAT0.capacity < 40 ? "" :
EWW_BATTERY.BAT0.capacity < 50 ? "" :
EWW_BATTERY.BAT0.capacity < 60 ? "" :
EWW_BATTERY.BAT0.capacity < 70 ? "" :
EWW_BATTERY.BAT0.capacity < 80 ? "" :
EWW_BATTERY.BAT0.capacity < 90 ? "" : ""
}`
:class "battery"
))
)
(defwidget batterymenu []
(box :orientation "v"
:class "batterymenu"
(label :text "${EWW_BATTERY.BAT0.status}: ${EWW_BATTERY.BAT0.capacity}%")
(progress :value "${EWW_BATTERY.BAT0.capacity}" :orientation "h") ; TODO: change class (and color) on low juice
)
)
(defwindow batterywindow
:monitor 0
:geometry (geometry
:x "53px"
:y "30px"
:anchor "bottom left"
)
(batterymenu)
)
; ━━━ do-not-disturb ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
(defvar dnd "")
(defwidget do-not-disturb []
(eventbox
:orientation "h"
:halign "center"
:space-evenly false
:onclick "nohup ./scripts/do-not-disturb.sh &"
(label
:text {dnd}
:class "dnd"
)
)
)
;; ━━━ WIFI ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
(defpoll wifi :interval "30s" "./scripts/wifi.sh")
(defwidget wifi []
(box
:orientation "h"
:halign "center"
:space-evenly false
(label
:text {wifi.icon}
:tooltip {wifi.status}
:class "wifi"
)
)
)
;; ━━━ VOLUME ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
(defpoll volume :interval "1s" "./scripts/volume.sh")
(defwidget volume []
(eventbox
:orientation "h"
:halign "center"
:space-evenly false
:onclick "pamixer -t"
(label
:text {volume.icon}
:tooltip "${volume.percent}%"
:class "volume"
)
)
)
;; ━━━ TIME ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
(defpoll hour :interval "10s" "date +%H")
(defpoll minute :interval "10s" "date +%M")
(defpoll dateVar :interval "600s" "date '+%A %d.%m.%y'")
(defwidget time []
(eventbox
:cursor "hand"
:hexpand false
:vexpand false
:tooltip "${dateVar}"
:onclick "eww open calendar --toggle &"
(box :orientation "v" :hexpand false :vexpand false :space-evenly false :class "clock"
(label :class "date" :text "${hour}")
(label :class "date" :text "${minute}")
)
)
)
;; Calendar
(defpoll calendar_day :interval "20h" "date '+%d'")
(defpoll calendar_year :interval "20h" "date '+%Y'")
(defwidget cal []
(box :class "cal" :orientation "v"
(box :class "cal-in"
(calendar :class "cal"
:day calendar_day
:year calendar_year))))
(defwindow calendar
:monitor 0
:geometry (geometry :x "53px"
:y "5px"
:anchor "bottom left"
:width "270px"
:height "60px")
(cal))
(deflisten workspaces_listen "./scripts/workspaces.sh")
(defwidget workspaces []
(literal :content workspaces_listen))
(defwindow bar
:monitor 0
:exclusive false
:geometry (geometry :height "1080px" :x "-4px" :y "0px"
:width "52px"
:anchor "top left")
:stacking "fg"
(bar))