sway/config: Use wob for sound and brightness overlays

wob is a Wayland overlay bar for things like sound and brightness
levels. It expects values to be between 0 and 100, which means we
need to use light instead of brightnessctl because the brightness
level is in lumens or something so it goes up to 1060 on my Think
Pad Carbon X1 Gen 6 and light represents it as a percentage. Also
we need to use pamixer instead of pactl because there is no simple
way to get the current volume with pactl.

See: https://github.com/francma/wob
This commit is contained in:
Alan Orth 2020-02-15 22:46:30 +02:00
parent b7d8529819
commit ce825d26f2
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -73,6 +73,9 @@ set $laptop eDP-1
bindswitch --reload lid:on output $laptop disable bindswitch --reload lid:on output $laptop disable
bindswitch --reload lid:off output $laptop enable bindswitch --reload lid:off output $laptop enable
# Wayland overlay bar for sound and brightness level
exec mkfifo $SWAYSOCK.wob && tail -f $SWAYSOCK.wob | wob
### Idle configuration ### Idle configuration
# #
# Example configuration: # Example configuration:
@ -148,12 +151,13 @@ input type:keyboard {
# Exit sway (logs you out of your Wayland session) # Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% bindsym XF86AudioRaiseVolume exec pamixer -ui 5 && pamixer --get-volume > $SWAYSOCK.wob
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% bindsym XF86AudioLowerVolume exec pamixer -ud 5 && pamixer --get-volume > $SWAYSOCK.wob
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle bindsym XF86AudioMute pamixer --toggle-mute && ( pamixer --get-mute && echo 0 > $SWAYSOCK.wob ) || pamixer --get-volume > $SWAYSOCK.wob
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
bindsym XF86MonBrightnessDown exec brightnessctl set 5%- bindsym XF86MonBrightnessUp exec light -A 5 && light -G | cut -d'.' -f1 > $SWAYSOCK.wob
bindsym XF86MonBrightnessUp exec brightnessctl set +5% bindsym XF86MonBrightnessDown exec light -U 5 && light -G | cut -d'.' -f1 > $SWAYSOCK.wob
# #
# Moving around: # Moving around:
# #