mirror of
https://github.com/Nickiel12/nicks-nix-config.git
synced 2024-11-26 14:45:29 -08:00
121 lines
3.5 KiB
Text
121 lines
3.5 KiB
Text
|
|
|
|
(defwidget info []
|
|
(box
|
|
:class "side-stuff"
|
|
:halign "end"
|
|
:space-evenly false
|
|
:spacing "25"
|
|
(box
|
|
:space-evenly false
|
|
:spacing "10"
|
|
(_volume :volume volume)
|
|
(_battery :status {EWW_BATTERY == "" ? "" : EWW_BATTERY.BAT0.status} :battery {EWW_BATTERY == "" ? "" : EWW_BATTERY.BAT0.capacity}))
|
|
(_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]
|
|
(eventbox
|
|
:onscroll "./scripts/volume {} ${EWW_EXECUTABLE}"
|
|
:onclick "./scripts/volume toggle ${EWW_EXECUTABLE}"
|
|
(box
|
|
:hexpand false
|
|
:class {(volume ?: 90) > 100 ? "alert" : "regular"}
|
|
(revealer-on-hover
|
|
:toggle volume-visible
|
|
:togglename "volume-visible"
|
|
(label :text {volume <= 0 ? " " :
|
|
volume < 33 ? " " :
|
|
volume < 66 ? " " :
|
|
volume < 99 ? " " : " "})
|
|
(label :text "${volume ?: "??"}%")
|
|
)
|
|
(volume_scale)
|
|
)))
|
|
|
|
|
|
(defvar battery-visible false)
|
|
(defwidget _battery [status battery]
|
|
(box
|
|
:hexpand false
|
|
:class {status == "" ? "regular" : battery < 20 ? "alert" : "regular"}
|
|
(revealer-on-hover
|
|
:toggle battery-visible
|
|
:togglename "battery-visible"
|
|
(label :text {status == 'Charging' || status == "" ? "" :
|
|
battery < 20 ? "" :
|
|
battery < 40 ? "" :
|
|
battery < 60 ? "" :
|
|
battery < 80 ? "" : ""})
|
|
(label :text "${battery}%"))))
|
|
|
|
(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")
|
|
|
|
(deflisten music :initial ""
|
|
"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
|
|
|
|
(defwidget music []
|
|
(box :class "music"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:halign "center"
|
|
{music != "" ? "🎵${music}" : ""}))
|
|
|
|
(defpoll volume :interval "1s"
|
|
{"pw-volume status | jaq '.percentage // -1'" ?: 500})
|
|
|
|
(include "status_bars.yuck")
|
|
(include "./modules/center-clock.yuck")
|
|
|
|
(defvar open_vol_osd false)
|
|
(defvar ANIM_DURATION "500ms")
|
|
(include "./modules/volume-osd.yuck")
|
|
(defvar show_elevation_prompt false)
|
|
(include "./dashboard/dashboard.yuck")
|