scripts:i3:volume

Volume Control Using i3

For muting, using ALSA to mute the Master output is a safe bet.

bindsym XF86AudioMute exec amixer -q set Master toggle

To adjust system volume, I have done this in 2 main ways:

Here, you can change how much you want to adjust the volume by (eg: 1%), and the sink number (eg: 2).

For example, I had the regular volume buttons change the 2nd sink volume, which is my USB DAC, and 'Mod1+XF86AudioRaiseVolume' to change the internal sound card volume by having it control sink 1.

bindsym XF86AudioRaiseVolume exec "pactl set-sink-volume 2 +1%"
bindsym XF86AudioLowerVolume exec "pactl set-sink-volume 2 -1%"

This will change the volume of whatever output device is selected as default. I have found a slight glitch, if you adjust volume too fast, the left and right channels may imbalance. In this case, bring the volume down to 0, then back up.

bindsym XF86AudioRaiseVolume exec "amixer -q set Master 5%+ unmute"
bindsym XF86AudioLowerVolume exec "amixer -q set Master 5%- unmute"

I saw this on Fedora git, and it works better. Use this. It doesn't imbalance. It does sometimes get stuck on my Lenovo Thinkpad E495 and go up or down to infinity, but I think that's the laptop, not the config.

# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym $mod+XF86AudioMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
  • scripts/i3/volume.txt
  • Last modified: 2022-06-03 20:45
  • by Tony