From ae3dd9681e45fb44daea8cdc6726b36313a21f2e Mon Sep 17 00:00:00 2001 From: James Patrick Date: Sun, 6 Oct 2019 00:15:30 -0400 Subject: [PATCH] Added wob support for brightness & volume. Project is early, but I'm hoping this will be a proper replacement for xob. https://github.com/francma/wob --- sway/config | 10 +++++----- sway/config.d/autostart | 7 +++++++ sway/scripts/sanitize_wob | 8 ++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) create mode 100755 sway/scripts/sanitize_wob diff --git a/sway/config b/sway/config index eeedf84..b10d32d 100644 --- a/sway/config +++ b/sway/config @@ -192,12 +192,12 @@ bindsym $mod+r mode "resize" # # Media Keys # -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 pactl set-sink-volume @DEFAULT_SINK@ +5% && pamixer --get-volume > /tmp/wobpipe +bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% && pamixer --get-volume > /tmp/wobpipe +bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && ( `pamixer --get-mute` && echo 0 || pamixer --get-volume ) > /tmp/wobpipe bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle -bindsym XF86MonBrightnessDown exec light -U 5 -bindsym XF86MonBrightnessUp exec light -A 5 +bindsym XF86MonBrightnessDown exec light -U 5 && light -G | cut -d'.' -f1 > /tmp/wobpipe +bindsym XF86MonBrightnessUp exec light -A 5 && light -G | cut -d'.' -f1 > /tmp/wobpipe bindsym Pause exec playerctl play-pause bindsym Shift+Pause exec bash ~/.config/rofi/scripts/media_controls diff --git a/sway/config.d/autostart b/sway/config.d/autostart index 0f68bb7..033b076 100644 --- a/sway/config.d/autostart +++ b/sway/config.d/autostart @@ -12,6 +12,13 @@ exec mako # https://github.com/nwg-piotr/autotiling exec --no-startup-id autotiling +# wob configuration +exec_always { + killall -q wob || true + mkfifo /tmp/wobpipe + tail -f /tmp/wobpipe | ~/.config/sway/scripts/sanitize_wob | wob +} + ### Clipboard manager # https://github.com/yory8/clipman #exec clipman -d diff --git a/sway/scripts/sanitize_wob b/sway/scripts/sanitize_wob new file mode 100755 index 0000000..8e257de --- /dev/null +++ b/sway/scripts/sanitize_wob @@ -0,0 +1,8 @@ +#!/bin/bash +while read IN +do + [[ ! $IN =~ ^[+-]?[0-9]+$ ]] && IN=0 + [[ $IN -gt 100 ]] && IN=100 + [[ $IN -lt 0 ]] && IN=0 + echo $IN +done < "${1:-/dev/stdin}"