From ce825d26f2870df77f958853fb8bfc47c6f990c5 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sat, 15 Feb 2020 22:46:30 +0200 Subject: [PATCH] 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 --- sway/config | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sway/config b/sway/config index 677321d..81dad97 100644 --- a/sway/config +++ b/sway/config @@ -73,6 +73,9 @@ set $laptop eDP-1 bindswitch --reload lid:on output $laptop disable 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 # # Example configuration: @@ -148,12 +151,13 @@ input type:keyboard { # 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 XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% - bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% - bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle + bindsym XF86AudioRaiseVolume exec pamixer -ui 5 && pamixer --get-volume > $SWAYSOCK.wob + bindsym XF86AudioLowerVolume exec pamixer -ud 5 && pamixer --get-volume > $SWAYSOCK.wob + 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 XF86MonBrightnessDown exec brightnessctl set 5%- - bindsym XF86MonBrightnessUp exec brightnessctl set +5% + bindsym XF86MonBrightnessUp exec light -A 5 && light -G | cut -d'.' -f1 > $SWAYSOCK.wob + bindsym XF86MonBrightnessDown exec light -U 5 && light -G | cut -d'.' -f1 > $SWAYSOCK.wob + # # Moving around: #