infrastructure/nixos/hosts/thalassa/null/home/eww/eww.yuck
2022-09-10 19:50:59 +02:00

128 lines
3.6 KiB
Plaintext

(defwidget bar []
(centerbox :orientation "v" :hexpand false
(box :valign "start" :hexpand false :vexpand true :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)
(volume)
(battery)
(time)
)
)
)
;; ━━━ WIFI ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
(defpoll wifi :interval "30s" "./scripts/wifi.sh")
(defwidget wifi []
(box :vexpand false :hexpand false :orientation "v"
(label :text {wifi.icon}
:limit-width 10
:tooltip {wifi.status}
:class "wifi"
)
)
)
;; ━━━ 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 ? "" : ""
}`
:limit-width 10
: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)
)
;; ━━━ VOLUME ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
(defpoll volume :interval "1s" "./scripts/volume.sh")
(defwidget volume []
(eventbox :onclick "pamixer -t"
(label :text {volume.icon}
:limit-width 10
: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))