commit ab9b1698768c40dbb7f8ad90ba51dcb8daaa2e20 parent 4b8509cada8c6b613d4df2a816f4a45109367ab0 Author: Chris Bracken <chris@bracken.jp> Date: Fri, 1 May 2020 17:58:05 -0700 i3, sway: get volume working with ALSA Abstract ALSA/PulseAudio commands behind variables. Update i3 and sway window manager configurations to use ALSA for volume handling. Diffstat:
M | .config/i3/config | | | 36 | ++++++++++++++++++++++++------------ |
M | .config/sway/config | | | 26 | +++++++++++++++++++------- |
2 files changed, 43 insertions(+), 19 deletions(-)
diff --git a/.config/i3/config b/.config/i3/config @@ -97,22 +97,34 @@ bindsym $mod+Shift+e exec ~/.config/i3/exit_check.sh ############################################################ -# Key bindings: Volume control +# Key bindings: Volume/Brightness + +# PulseAudio: +# set $volume_up pactl set-sink-volume @DEFAULT_SINK@ +5% +# set $volume_down pactl set-sink-volume @DEFAULT_SINK@ -5% +# set $volume_toggle_mute pactl set-sink-mute @DEFAULT_SINK@ toggle +# set $volume_toggle_mic_mute pactl set-source-mute @DEFAULT_SOURCE@ toggle +# +# Alsa: +set $volume_up amixer -q sset Master 5%+ +set $volume_down amixer -q sset Master 5%- +set $volume_toggle_mute amixer -q sset Master toggle +set $volume_toggle_mic_mute amixer -q sset Mic toggle # Increase and decrease volume. -bindsym Control+$mod+F12 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% -bindsym Control+$mod+F11 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% -bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% -bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% +bindsym Control+$mod+F12 exec --no-startup-id $volume_up +bindsym Control+$mod+F11 exec --no-startup-id $volume_down +bindsym XF86AudioRaiseVolume exec --no-startup-id $volume_up +bindsym XF86AudioLowerVolume exec --no-startup-id $volume_down # Handle media keys. -bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle -bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle -bindsym XF86MonBrightnessDown exec brightnessctl set 5%- -bindsym XF86MonBrightnessUp exec brightnessctl set +5% -bindsym XF86AudioPlay exec playerctl play-pause -bindsym XF86AudioNext exec playerctl next -bindsym XF86AudioPrev exec playerctl previous +bindsym XF86AudioMute exec --no-startup-id $volume_toggle_mute +bindsym XF86AudioMicMute exec --no-startup-id $volume_toggle_mic_mute +bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%- +bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +5% +bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause +bindsym XF86AudioNext exec --no-startup-id playerctl next +bindsym XF86AudioPrev exec --no-startup-id playerctl previous ############################################################ diff --git a/.config/sway/config b/.config/sway/config @@ -125,17 +125,29 @@ bindsym $mod+Shift+e exec ~/.config/sway/exit_check.sh ############################################################ -# Key bindings: Volume control +# Key bindings: Volume/Brightness + +# PulseAudio: +# set $volume_up pactl set-sink-volume @DEFAULT_SINK@ +5% +# set $volume_down pactl set-sink-volume @DEFAULT_SINK@ -5% +# set $volume_toggle_mute pactl set-sink-mute @DEFAULT_SINK@ toggle +# set $volume_toggle_mic_mute pactl set-source-mute @DEFAULT_SOURCE@ toggle +# +# Alsa: +set $volume_up amixer -q sset Master 5%+ +set $volume_down amixer -q sset Master 5%- +set $volume_toggle_mute amixer -q sset Master toggle +set $volume_toggle_mic_mute amixer -q sset Mic toggle # Increase and decrease volume. -bindsym Control+$mod+F12 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% -bindsym Control+$mod+F11 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% -bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% -bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% +bindsym Control+$mod+F12 exec $volume_up +bindsym Control+$mod+F11 exec $volume_down +bindsym XF86AudioRaiseVolume exec $volume_up +bindsym XF86AudioLowerVolume exec $volume_down # Handle media keys. -bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle -bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle +bindsym XF86AudioMute exec $volume_toggle_mute +bindsym XF86AudioMicMute exec $volume_toggle_mic_mute bindsym XF86MonBrightnessDown exec brightnessctl set 5%- bindsym XF86MonBrightnessUp exec brightnessctl set +5% bindsym XF86AudioPlay exec playerctl play-pause