scripts:i3:volume

no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


scripts:i3:volume [2022-06-03 20:45] (current) – created Tony
Line 1: Line 1:
 +====== Volume Control Using i3 ======
 +
 +
 +===== Change system volume/mute from media controls =====
 +
 +For muting, using ALSA to mute the Master output is a safe bet.
 +
 +<code>bindsym XF86AudioMute exec amixer -q set Master toggle
 +</code>
 +To adjust system volume, I have done this in 2 main ways:
 +
 +
 +==== Using Pulseaudio ====
 +
 +
 +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.
 +
 +<code>bindsym XF86AudioRaiseVolume exec "pactl set-sink-volume 2 +1%"
 +bindsym XF86AudioLowerVolume exec "pactl set-sink-volume 2 -1%"
 +</code>
 +
 +==== Using ALSA ====
 +
 +
 +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.
 +
 +<code>bindsym XF86AudioRaiseVolume exec "amixer -q set Master 5%+ unmute"
 +bindsym XF86AudioLowerVolume exec "amixer -q set Master 5%- unmute"
 +</code>
 +
 +
 +==== New method from Fedora config ====
 +
 +I saw this on Fedora git, and it works better. Use this. It doesn't imbalance. It does sometimes get stuck on my [[reviews:lenovo_thinkpad_e495|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