nicks-nix-config/modules/ewwbar/eww-config/eww.yuck

122 lines
3.5 KiB
Text
Raw Permalink Normal View History

2023-10-24 18:31:26 -07:00
2023-10-26 18:26:39 -07:00
(defwidget info []
(box
:class "side-stuff"
:halign "end"
:space-evenly false
:spacing "25"
(box
:space-evenly false
:spacing "10"
(_volume :volume volume)
2023-10-29 18:27:21 -07:00
(_battery :status {EWW_BATTERY == "" ? "" : EWW_BATTERY.BAT0.status} :battery {EWW_BATTERY == "" ? "" : EWW_BATTERY.BAT0.capacity}))
2023-10-26 18:26:39 -07:00
(_network :strength net-strength :name net-name)
(sep)
(buttons)))
(defvar eww "eww -c $HOME/.config/eww")
(defwidget revealer-on-hover [toggle togglename ?transition ?duration]
(eventbox
:onhover "${eww} update ${togglename}=true"
:onhoverlost "${eww} update ${togglename}=false"
(box
:space-evenly false
(children :nth 0)
(revealer
:reveal toggle
:transition {transition ?: "slideright"}
:duration {duration ?: "300ms"}
(children :nth 1)))))
(defvar volume-visible false)
(defwidget _volume [volume]
2023-10-30 18:12:43 -07:00
(eventbox
:onscroll "./scripts/volume {} ${EWW_EXECUTABLE}"
:onclick "./scripts/volume toggle ${EWW_EXECUTABLE}"
(box
:hexpand false
2023-10-30 21:17:26 -07:00
:class {(volume ?: 90) > 100 ? "alert" : "regular"}
2023-10-30 18:12:43 -07:00
(revealer-on-hover
:toggle volume-visible
:togglename "volume-visible"
(label :text {volume <= 0 ? "󰝟 " :
volume < 33 ? "󰕿 " :
volume < 66 ? "󰖀 " :
volume < 99 ? "󰕾 " : "󱄡 "})
2023-10-30 21:17:26 -07:00
(label :text "${volume ?: "??"}%")
)
(volume_scale)
)))
2023-10-24 18:31:26 -07:00
2023-10-26 18:26:39 -07:00
(defvar battery-visible false)
(defwidget _battery [status battery]
(box
:hexpand false
2023-10-29 18:27:21 -07:00
:class {status == "" ? "regular" : battery < 20 ? "alert" : "regular"}
2023-10-26 18:26:39 -07:00
(revealer-on-hover
:toggle battery-visible
:togglename "battery-visible"
2023-10-29 18:27:21 -07:00
(label :text {status == 'Charging' || status == "" ? "󰚥" :
2023-10-26 18:26:39 -07:00
battery < 20 ? "󰁻" :
battery < 40 ? "󰁽" :
battery < 60 ? "󰁿" :
battery < 80 ? "󰂁" : "󰁹"})
(label :text "${battery}%"))))
2023-10-24 18:31:26 -07:00
2023-10-26 18:26:39 -07:00
(defvar network-visible false)
(defwidget _network [strength name]
(box
:hexpand false
:vexpand true
:class "regular"
(revealer-on-hover
:toggle network-visible
:togglename "network-visible"
:ransition "slidedown"
(label :text {strength == "" ? "󰤮 " :
strength < 26 ? "󰤟 " :
strength < 51 ? "󰤢 " :
strength < 76 ? "󰤥 " : "󰤨 "})
(label :text "${name} (${strength})"))))
(defwidget buttons []
(box
:halign "end"
:hexpand false
:space-evenly true
:spacing "15"
(box (button :onclick `hyprctl dispatch exit` "󰍃 "))
(box (button :onclick `reboot` " "))
(box (button :onclick `shutdown now` " "))))
(defwidget sep [] (box :hexpand false (label :class "sep" :text "|")))
(defpoll net-strength :interval "5s" :initial `N/A`
`nmcli -t -f SIGNAL,ACTIVE device wifi | awk -F':' '{if($2=="yes")print$1}'`)
(defpoll net-name :interval "60s" :initial "N/A" "nmcli -t -f NAME c show --active | head -n 1")
2023-10-24 18:31:26 -07:00
(deflisten music :initial ""
"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
2023-10-26 18:26:39 -07:00
(defwidget music []
(box :class "music"
:orientation "h"
:space-evenly false
:halign "center"
{music != "" ? "🎵${music}" : ""}))
2023-10-24 18:31:26 -07:00
(defpoll volume :interval "1s"
2023-11-16 16:24:23 -08:00
{"pw-volume status | jaq '.percentage // -1'" ?: 500})
2023-10-24 18:31:26 -07:00
(include "status_bars.yuck")
2023-10-30 21:17:26 -07:00
(include "./modules/center-clock.yuck")
(defvar open_vol_osd false)
(defvar ANIM_DURATION "500ms")
(include "./modules/volume-osd.yuck")
(defvar show_elevation_prompt false)
2023-10-31 23:04:06 -07:00
(include "./dashboard/dashboard.yuck")