blob: a7695acd0ec74f6f27506bf507b17481038b1eae [file] [log] [blame]
(defwidget bar []
(centerbox :orientation "h"
:class "bar"
(workspaces)
(music)
(sidestuff)))
(defwidget sidestuff []
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
(metric :label "🔊"
:value volume
:onchange "nix run nixpkgs#pamixer -- --set-volume {}")
(radio)
(sysinfo)
time))
(defwidget radio []
(box :class "radio" :orientation "h" :space-evenly false :halign "end"
(button :class bluetooth
:onclick { bluetooth == "inactive" ? "bluetoothctl power on" : "bluetoothctl power off"}
"īŠ“")
(button :class wifi
:onclick { wifi == "disabled" ? "nmcli radio wifi on" : "nmcli radio wifi off"}
"🛜")
)
)
(defwidget sysinfo []
(box :class "sysinfo"
; (metric :label { battery_status == "Normal" ? "🔋" : "đŸĒĢ" }
; :value battery_cap
; :onchange "")
(metric :label "🐏"
:value {EWW_RAM.used_mem_perc}
:onchange "")
(metric :label "💾"
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
:onchange "")
(metric :label "🕓"
:value cpu_usage_percent
:onchange "")
)
)
(defwidget workspaces []
(box :class "workspaces"
:orientation "h"
:space-evenly true
:halign "start"
:spacing 10
(button :onclick "hyprctl dispatch workspace 1" 1)
(button :onclick "hyprctl dispatch workspace 2" 2)
(button :onclick "hyprctl dispatch workspace 3" 3)
(button :onclick "hyprctl dispatch workspace 4" 4)
(button :onclick "hyprctl dispatch workspace 5" 5)
(button :onclick "hyprctl dispatch workspace 6" 6)
(button :onclick "hyprctl dispatch workspace 7" 7)
(button :onclick "hyprctl dispatch workspace 8" 8)
(button :onclick "hyprctl dispatch workspace 9" 9)
(button :onclick "hyprctl dispatch workspace 0" 0)
))
(defwidget music []
(box :class "music"
:orientation "h"
:space-evenly false
:halign "center"
:onclick ""
{music != "" ? "đŸŽĩ${music}" : ""}))
(defwidget metric [label value onchange]
(box :orientation "h"
:class "metric"
:space-evenly false
(box :class "label" label)
(scale :min 0
:max 101
:active {onchange != ""}
:value value
:onchange onchange)))
(deflisten music :initial ""
"nix run nixpkgs#playerctl -- --follow metadata --format '{{ title }}' || true")
(defpoll bluetooth :interval "1s"
"rfkill -o TYPE,SOFT list -n | grep bluetooth | sed -E 's/bluetooth\s+//g'")
(defpoll wifi :interval "1s"
"rfkill -o TYPE,SOFT list -n | grep wlan | sed -E 's/wlan\s+//g'")
(defpoll volume :interval "1s"
"nix run nixpkgs#pamixer -- --get-volume")
(defpoll battery_cap :interval "5m"
"cat /sys/class/power_supply/BAT*/capacity"
)
(defpoll battery_status :interval "1s"
"cat /sys/class/power_supply/BAT*/status"
)
(defpoll cpu_usage_percent :interval "5s"
"bash scripts/cpu_usage"
)
(defpoll time :interval "1s"
"date '+%H:%M:%S %b %d, %Y'")
(defwindow bar-primary
:monitor 0
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "100%"
:height "10px"
:anchor "top center")
:exclusive true
(bar))