Skip to content

Instantly share code, notes, and snippets.

@katoozi
Last active May 27, 2019 07:39
Show Gist options
  • Save katoozi/802ede2ad3d9ebd008431ad9dde69c5d to your computer and use it in GitHub Desktop.
Save katoozi/802ede2ad3d9ebd008431ad9dde69c5d to your computer and use it in GitHub Desktop.
my i3 script for increase, decrease and mute sound
# 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
#!/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