Add hyprstack config

This commit is contained in:
2024-07-06 12:59:14 +03:00
parent ead8c1df03
commit b820d657ee
32 changed files with 1417 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
(defpoll volume-level :interval "1s" "sh widgets/audio/get-volume-level.sh")
(defwidget icon []
(label :text {volume-level > 66 ? "" : volume-level > 0 ? "" : ""})
)
; TODO figure out the sink IDs dynamically?
(defwidget audio []
(box
:orientation "h"
:space-evenly false
:halign "end"
(eventbox :cursor "pointer" (button :class "audio-source interactive" :onclick "pactl set-default-sink 57" "󰍹"))
(eventbox :cursor "pointer" (button :class "audio-source-2 interactive" :onclick "pactl set-default-sink 64" "󰋋"))
(eventbox :cursor "pointer" :class "interactive" :onscroll "sh widgets/audio/change-volume.sh {}"
(box :class "volume"
(icon)
(button :onclick "pavucontrol &"
(label :text "${volume-level}%")
)
))
)
)
@@ -0,0 +1,9 @@
#!/usr/bin/env sh
if [[ $1 == "up" ]]; then
wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
elif [[ $1 == "down" ]]; then
wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
else
wpctl set-volume @DEFAULT_AUDIO_SINK@ $1
fi
@@ -0,0 +1,21 @@
#!/usr/bin/env sh
volume=$(wpctl get-volume @DEFAULT_AUDIO_SINK@)
#todo fix 100% case
volume_value=$(echo $volume | cut -d':' -f2)
if [ $volume_value == "0.00" ]; then
echo "0"
exit 0
fi
if [[ $volume_value =~ ^" 1" ]]; then
echo "${volume_value//.}"
exit 0
fi
volume_percent=$(echo $volume_value | cut -d'.' -f2)
echo $volume_percent