feat: adjust eww var timings and add dynamic mic icon

This commit is contained in:
matt1432 2023-08-04 23:01:46 -04:00
parent 45b9992bd5
commit 54233a6690
6 changed files with 37 additions and 5 deletions

View file

@ -194,9 +194,9 @@
(eventbox :class "left-part"
:cursor "pointer"
:onclick "swayosd --input-volume mute-toggle"
:onclick "$EWW_PATH/mic.sh toggle-muted"
(label :text " 󰍬 "
(label :text " ${mic_icon} "
:class "grid-label"
)
)

View file

@ -56,11 +56,12 @@ fi
if [[ $1 == "icon" ]]; then
while true; do
sleep 0.2
sleep 0.01
get_icon
done
fi
if [[ $1 == "set" ]]; then
eww update br=$2
brightnessctl set $2%
fi

30
config/eww/scripts/mic.sh Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
SOURCE="@DEFAULT_SOURCE@"
is_muted () {
pactl get-source-mute $SOURCE | awk '{print $2}'
}
get_icon () {
if [[ $(is_muted) == "yes" ]]; then
echo " 󰍭"
else
echo " 󰍬"
fi
}
if [[ $1 == "icon" ]]; then
while true; do
sleep 0.01
get_icon
done
fi
if [[ $1 == "muted" ]]; then
is_muted
fi
if [[ $1 == "toggle-muted" ]]; then
swayosd --input-volume mute-toggle
fi

View file

@ -23,7 +23,7 @@ icon () {
if [[ $1 == "icon" ]]; then
while true; do
sleep 0.2
sleep 0.01
icon
done
fi

View file

@ -61,7 +61,7 @@ get_vol () {
if [[ $1 == "icon" ]]; then
while true; do
sleep 0.2
sleep 0.01
get_icon
done
fi

View file

@ -1,5 +1,6 @@
(deflisten notif_icon "$EWW_PATH/notif.sh icon")
(deflisten heart_icon "tail -f $HOME/.config/.heart")
(deflisten mic_icon "$EWW_PATH/mic.sh icon")
(deflisten volume_icon "$EWW_PATH/volume.sh icon")
(defpoll volume :interval "1s" "$EWW_PATH/volume.sh percentage")