Last active
May 27, 2019 07:39
-
-
Save katoozi/802ede2ad3d9ebd008431ad9dde69c5d to your computer and use it in GitHub Desktop.
my i3 script for increase, decrease and mute sound
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add this three line to i3 config file | |
bindsym XF86AudioRaiseVolume exec --no-startup-id ~/.i3/sound_script.sh incr #increase sound volume | |
bindsym XF86AudioLowerVolume exec --no-startup-id ~/.i3/sound_script.sh decr #decrease sound volume | |
bindsym XF86AudioMute exec --no-startup-id ~/.i3/sound_script.sh # mute sound |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sink="$(pactl list sinks | grep "Sink #")" | |
sink_length="${#sink}" | |
position="$(echo $sink | grep -b -o "#")" | |
position="${position:0:1}" | |
number="${sink:position+1:sink_length}" | |
if [ "$1" = "incr" ]; then | |
pactl set-sink-volume $number +5% | |
elif [ "$1" = "decr" ]; then | |
pactl set-sink-volume $number -5% | |
else | |
pactl set-sink-mute $number toggle | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment