From b16060a21889feb0fbeeed8a7513eeda3da61ef7 Mon Sep 17 00:00:00 2001
From: Daniel Lundin <dln@eintr.org>
Date: Wed, 19 Feb 2020 18:45:45 +0100
Subject: [PATCH] sway: use wob to show volume

---
 .config/sway/config | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/.config/sway/config b/.config/sway/config
index 55e2c3a..8cd1509 100644
--- a/.config/sway/config
+++ b/.config/sway/config
@@ -17,9 +17,9 @@ input "1:1:AT_Translated_Set_2_keyboard" {
   xkb_layout us-se-umlauts
 }
 
-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 2 && pamixer --get-volume > $SWAYSOCK.wob
+bindsym XF86AudioLowerVolume exec pamixer -ud 2 && pamixer --get-volume > $SWAYSOCK.wob
+bindsym XF86AudioMute exec 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%
@@ -100,6 +100,7 @@ output "eDP-1" scale 1
 output "eDP-1" background #000000 solid_color
 output "eDP-1" bg /home/dln/.config/sway/laser.png center
 
+exec rm -f $SWAYSOCK.wob && mkfifo $SWAYSOCK.wob && tail -f $SWAYSOCK.wob | wob -W 2000 -H 100 -M 10 -a bottom
 exec mako
 exec redshift
 exec "systemctl --user import-environment; systemctl --user start sway-session.target"