sway: fix volume keys for dynamic pa sink

This commit is contained in:
Konstantin Koslowski 2020-12-22 17:04:22 +01:00
parent 2dc0b34814
commit 01307d799a
2 changed files with 28 additions and 3 deletions

23
bin/volume Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
sink=$(pactl list sinks | grep -B 1 "State: RUNNING" | grep -oE '[0-9]*')
cmd=""
if [ -z "$sink" ]; then
echo "ERROR: invalid sink: \"$sink\""
exit 1
fi
case $1 in
d*)
pactl set-sink-volume $sink -5%
;;
i*)
pactl set-sink-volume $sink +5%
;;
m*)
pactl set-sink-mute $sink toggle
;;
*)
echo "ERROR: invalid command: \"$1\""
;;
esac

8
config
View file

@ -17,6 +17,7 @@ set $right l
set $term termite
set $background $HOME/Cloud/xkonni/Pictures/wallpaper/5k_bavarian_forest_bw.jpg
set $lock_cmd $HOME/.config/sway/bin/lock
set $volume_cmd "$HOME/.config/sway/bin/volume
set $font "Cascadia Code PL Regular 10"
# Your preferred application launcher
@ -150,9 +151,10 @@ bindsym $mod+a focus parent
#
## Volume
#
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5%
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5%
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle
bindsym XF86AudioRaiseVolume exec $volume_cmd increase
bindsym XF86AudioLowerVolume exec $volume_cmd decrease
bindsym XF86AudioMute exec $volume_cmd mute
#
## Screenshot
#