From 72f543bac4263ce448a02b267a369e75cfba2f47 Mon Sep 17 00:00:00 2001 From: Konstantin Koslowski Date: Mon, 4 Jan 2021 17:37:20 +0100 Subject: [PATCH] sway: update status to toggle pavucontrol --- bin/volume | 13 +++++++++++++ conf.d/i3status_7DPQTN2.toml | 1 + conf.d/i3status_annoyance.toml | 1 + conf.d/i3status_silence.toml | 1 + 4 files changed, 16 insertions(+) diff --git a/bin/volume b/bin/volume index 9656fc0..0c3f0c7 100755 --- a/bin/volume +++ b/bin/volume @@ -1,12 +1,22 @@ #!/bin/bash sink=$(pacmd list-sinks | grep "* index" | grep -oE '[0-9]*') cmd="" +app="pavucontrol" if [ -z "$sink" ]; then echo "ERROR: invalid sink: \"$sink\"" exit 1 fi +function _toggle() { + a=$1 + if [ $(pgrep $a) ]; then + killall $a + else + $a &> /dev/null & + fi +} + case $1 in d*) pactl set-sink-volume $sink -5% @@ -17,6 +27,9 @@ case $1 in m*) pactl set-sink-mute $sink toggle ;; + gui) + _toggle $app + ;; *) echo "ERROR: invalid command: \"$1\"" ;; diff --git a/conf.d/i3status_7DPQTN2.toml b/conf.d/i3status_7DPQTN2.toml index 1d58ffd..1423665 100644 --- a/conf.d/i3status_7DPQTN2.toml +++ b/conf.d/i3status_7DPQTN2.toml @@ -41,6 +41,7 @@ interface_name_include = [] [[block]] block = "sound" step_width = 3 +on_click = "$HOME/.config/sway/bin/volume gui" [[block]] block = "bluetooth" diff --git a/conf.d/i3status_annoyance.toml b/conf.d/i3status_annoyance.toml index 4db4845..6fd17f3 100644 --- a/conf.d/i3status_annoyance.toml +++ b/conf.d/i3status_annoyance.toml @@ -41,6 +41,7 @@ interface_name_include = [] [[block]] block = "sound" step_width = 3 +on_click = "$HOME/.config/sway/bin/volume gui" [[block]] block = "music" diff --git a/conf.d/i3status_silence.toml b/conf.d/i3status_silence.toml index 28984a3..37f468d 100644 --- a/conf.d/i3status_silence.toml +++ b/conf.d/i3status_silence.toml @@ -41,6 +41,7 @@ interface_name_include = [] [[block]] block = "sound" step_width = 3 +on_click = "$HOME/.config/sway/bin/volume gui" [[block]] block = "music"