feat(eww): add mediaplayer widget, fix workspaces, window and audio widgets

This commit is contained in:
João Dias
2024-11-24 11:14:12 -03:00
parent 88af8f4a37
commit f7ae531efd
11 changed files with 115 additions and 71 deletions
+14 -4
View File
@@ -2,17 +2,27 @@
# Note: $SCROLL is defined by eww
$DEFAULT_INCREASE='5'
DEFAULT_INCREASE='5'
Guess_increase_decrease() {
local $CURRENT_VOL=$(wpctl get-volume "@DEFAULT_AUDIO_SINK@")
CURRENT_VOL=$(Translate_volume_to_int)
if [[ $SCROLL == "up" ]]; then
if [[ $(awk "BEGIN { ($CURRENT_VOL+$DEFAULT_INCREASE) }") > 100 ]]; then
echo "1.00"
else
echo "$DEFAULT_INCREASE%+"
fi
else
echo "$DEFAULT_INCREASE%-"
fi
}
Update_volume() {
local $UPDATED_VOL=$(Guess_increase_decrease)
UPDATED_VOL=$(Guess_increase_decrease)
wpctl set-volume "@DEFAULT_AUDIO_SINK@" "$UPDATED_VOL"
}
Translate_volume_to_int() {
echo $(wpctl get-volume "@DEFAULT_AUDIO_SINK@" | sed -e "s/^Volume: //" -e "s/^1.//1")
echo $(wpctl get-volume @DEFAULT_AUDIO_SINK@ | sed -e 's/Volume: //' -e 's/^1\./1/' -e 's/^0.//' -e 's/^00/0/')
}