diff options
Diffstat (limited to '.config/eww/bar.yuck')
| -rw-r--r-- | .config/eww/bar.yuck | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/.config/eww/bar.yuck b/.config/eww/bar.yuck new file mode 100644 index 0000000..a691155 --- /dev/null +++ b/.config/eww/bar.yuck @@ -0,0 +1,87 @@ +(deflisten tags_json :initial `[]` `river-bedload -minified -watch tags`) +(deflisten wintitle :initial `[{"title":""}]` `river-bedload -minified -watch title`) +(defpoll song :initial "" :interval "5s" `rmpc song`) +(deflisten cava :initial "" `cava -p ~/.config/eww/cava.ini | python3 ~/.config/eww/cava.py`) + +(defwindow bar + :monitor 0 + :geometry (geometry :x "0%" + :y "8px" + :width "1904px" + :height "32px" + :anchor "top center") + :stacking "fg" + :exclusive true + :focusable false + (bar)) + +(defwidget bar [] + (centerbox :orientation "h" + :class "bar" + (tags) + (center) + (status))) + +(defwidget tags [] + (box :orientation "h" + :halign "start" + :class "tags" + (for tag in "[1, 2, 3, 4, 5, 6, 7, 8, 9]" + (button :onclick `riverctl set-focused-tags $(dc -e"2 ${tag} 1- ^p")` + :class {jq(tags_json, `.[] | select(.id == ${tag}) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class})))) + + +(defwidget center [] + (box :orientation "h" + :spacing 4 + :space-evenly false + :class "music" + (label :text "${song.metadata.artist} - ${song.metadata.title}" :class "song") + (label :text {cava} :class "cava"))) + + +(defwidget title [] + (label :text {wintitle[0].title} + :class "title" + :show-truncated true + :visible {wintitle[0].title != ""} + :limit-width 55)) + +(deflisten volume :initial "0" `monitor-volume`) +(defpoll ssid :initial "" :interval "10s" `iwctl station wlan0 get-networks | awk -F' ' '/>/{print $3}'`) +(deflisten brightness :initial "0" `brightctl -l`) +(defpoll bartime :initial "" :interval "1s" `date '+%b %-d %H:%M:%S'`) + +(defvar showvol false) + +(defwidget status [] + (box :orientation "h" + :halign "end" + :class "status" + :spacing 8 + :space-evenly false + (revealer-on-hover :var showvol + :varname "showvol" + :icon "a" + :transition "slideleft" + :class "volume" + (scale :orientation "h" + :min 0 + :max 1 + :value {volume} + :onchange `wpctl set-volume @DEFAULT_SINK@ {}`) + (label :text "${matches(volume, "MUTED") ? " " : volume == 0 ? "" : volume < 50 ? "" : " "} ${volume}%" + :class "volume")) + (label :text "${ssid == "" ? "" : ""} ${ssid}" + :class "network") + (label :text " ${brightness}%" + :class "brightness") + (label :text "${`{"Discharging": ["","","","","","","","","",""], "Charging": ["","","","","","","","","",""]}`?.[EWW_BATTERY.BAT0.status]?.[round((EWW_BATTERY.BAT0.capacity - 1) / 10, 0)] ?: ""} ${EWW_BATTERY.BAT0.capacity}%" + :class "battery") + (label :text " ${bartime}" + :class "clock") + ;(label :text "" + ;:class "menu"))) + (label :text "" + :class "power"))) + |
