Listeners for volume and mic mute bar
This commit is contained in:
parent
36d2211220
commit
bdbb944ad5
2 changed files with 8 additions and 12 deletions
|
@ -30,7 +30,7 @@ paru -Sy --needed \
|
|||
passff-host `# Pass integration in Firefox` \
|
||||
kitty-git `# Terminal Emulator` \
|
||||
wezterm `# Terminal Emulator` \
|
||||
pavucontrol pamixer `# Pulseaudio Controls` \
|
||||
pavucontrol pamixer pactl `# Pulseaudio Controls` \
|
||||
playerctl `# Media Keys Controls` \
|
||||
feh `# Image Viewer and Wallpaper Manager` \
|
||||
hyprland hyprpaper `# Wayland Compositor` \
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
time
|
||||
; TODO: idle inhibitor?
|
||||
; TODO: get these to align properly?
|
||||
(box :class "mic" (box :class {micMuted == "false" ? "muted" : "live"} {micMuted == "false" ? " " : " "}))
|
||||
(box :class "mic" (box :class {micMuted == "false" ? "live" : "muted"} {micMuted == "false" ? " " : " "}))
|
||||
{" " + volume}
|
||||
{" " + cpu}
|
||||
{" " + ram}
|
||||
|
@ -40,20 +40,16 @@
|
|||
(deflisten music :initial ""
|
||||
"playerctl --follow metadata --format '{{ title }} by {{ artist }}' || true")
|
||||
|
||||
; convert these to `deflisten`s as well because polling is very silly
|
||||
(defpoll volume :interval "1s"
|
||||
"pamixer --get-volume")
|
||||
(deflisten volume :initial "0"
|
||||
"pamixer --get-volume; pactl subscribe | grep sink --line-buffered | while read i; do pamixer --get-volume; done")
|
||||
|
||||
(defpoll micVolume :interval "10s"
|
||||
"pamixer --default-source --get-volume")
|
||||
(deflisten micMuted :initial "false"
|
||||
"pamixer --default-source --get-mute; pactl subscribe | grep source --line-buffered | while read i; do pamixer --default-source --get-mute; done")
|
||||
|
||||
(defpoll micMuted :interval "1s"
|
||||
"pamixer --default-source --get-mute")
|
||||
|
||||
(defpoll cpu :interval "1s"
|
||||
(defpoll cpu :interval "5s"
|
||||
"mpstat -o JSON | jq -r '(100 - .sysstat.hosts[0].statistics[0][\"cpu-load\"][0].idle | round | tostring)+\"%\"'")
|
||||
|
||||
(defpoll ram :interval "1s"
|
||||
(defpoll ram :interval "5s"
|
||||
"free | grep Mem | awk '{printf \"%.0f%\", $3/$2 * 100.0}'")
|
||||
|
||||
(defpoll time :interval "1s"
|
||||
|
|
Reference in a new issue