aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar remph <lhr@disroot.org>2024-11-15 02:29:00 +0000
committerLibravatar remph <lhr@disroot.org>2024-11-15 02:29:00 +0000
commitf42cb4b553c65da0b925c48504ec47e5d1a5e6fb (patch)
tree37378f534a824c1110748fbde74eafe44eb92642
parentc9d15be9602603d34e457818f150b23d0666e77b (diff)
parent549e328b61c44bc6fe244f14a4eeaf1bfa464a9b (diff)
Merge branch 'master' into other-audio-types
-rw-r--r--swob-swayconfig11
-rwxr-xr-xswob.sh14
2 files changed, 12 insertions, 13 deletions
diff --git a/swob-swayconfig b/swob-swayconfig
index 969326b..b74c114 100644
--- a/swob-swayconfig
+++ b/swob-swayconfig
@@ -1,5 +1,6 @@
-bindsym XF86MonBrightnessDown exec swob.sh brightness 5%-
-bindsym XF86MonBrightnessUp exec swob.sh brightness 5%+
-bindsym XF86AudioLowerVolume exec swob.sh volume 5%-
-bindsym XF86AudioRaiseVolume exec swob.sh volume 5%+
-bindsym XF86AudioMute exec swob.sh volume toggle
+# `exec exec' prevents pointless extra shell process
+bindsym --locked XF86MonBrightnessDown exec exec swob.sh brightness 5%-
+bindsym --locked XF86MonBrightnessUp exec exec swob.sh brightness 5%+
+bindsym --locked XF86AudioLowerVolume exec exec swob.sh volume 5%-
+bindsym --locked XF86AudioRaiseVolume exec exec swob.sh volume 5%+
+bindsym --locked XF86AudioMute exec exec swob.sh volume toggle
diff --git a/swob.sh b/swob.sh
index 6fd40a0..463d02e 100755
--- a/swob.sh
+++ b/swob.sh
@@ -2,11 +2,9 @@
# SPDX-FileCopyrightText: 2023-2024 The Remph <lhr@disroot.org>
# SPDX-License-Identifier: GPL-3.0-or-later
-wobfifo=${XDG_RUNTIME_DIR:-${TMPDIR:-/tmp}}/wob
+set ${BASH_VERSION:+-o pipefail} -efu
+wobfifo=$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY.swob
wobini=
-readonly wobfifo
-# `set -e' comes after readonly, which isn't vital enough to kill the script for
-set ${BASH_VERSION:+-o pipefail} -efmu
set_wobini() {
for dir in ${XDG_CONFIG_HOME:+"$XDG_CONFIG_HOME"} ~/.config /etc; do
@@ -46,11 +44,11 @@ start_wob() {
set_wobini
# spawn wob process with temporary file(s)
- (
+ {
trap 'rm "$wobfifo"' 0
# Don't `exec' wob here, else the trap won't work
- wob -c "$wobini" -v <$wobfifo
- ) &
+ wob -c "$wobini" <$wobfifo
+ } &
}
glob_match() {
@@ -178,4 +176,4 @@ start_wob
# soon as it's done sleeping (the existing situation is that as long as one
# script sleeps, the shell that spawned the wob process will wait until that
# sleep is done)
-test -z $! || wait $!
+test -z ${!-} || wait $! # surprisingly, $! could be unset (not just zero-length)