aboutsummaryrefslogtreecommitdiff
path: root/swob.sh
diff options
context:
space:
mode:
authorLibravatar remph <lhr@disroot.org>2024-10-10 18:03:10 +0100
committerLibravatar remph <lhr@disroot.org>2024-10-10 18:07:49 +0100
commit85ca59aea4669ebb9ca46ff62cf2a4248ec61436 (patch)
treee756e4266e9259a0c86c8e66f3745890793b4128 /swob.sh
parent3de3d1e46625a272e8e4e529786573dcbed36ceb (diff)
Init a swob/wob.ini if not present, instead of using a temp file. Also,
dwl config.h
Diffstat (limited to 'swob.sh')
-rwxr-xr-xswob.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/swob.sh b/swob.sh
index 222c62b..d0a92b6 100755
--- a/swob.sh
+++ b/swob.sh
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: FSFULLRWD
wobfifo=${XDG_RUNTIME_DIR:-${TMPDIR:-/tmp}}/wob
-wobini= wobini_istemp=
+wobini=
readonly wobfifo
set -o pipefail -efmu # `set -e' comes after readonly and pipefail, they
# aren't vital enough to kill the script for
@@ -17,13 +17,16 @@ set_wobini() {
done
# fallthrough to default: temporary wob.ini(5) standin
- echo >&2 "$0: warning: no swob/wob.ini found; defaulting to temporary"
- wobini=`mktemp` wobini_istemp=1
+ wobini=${XDG_CONFIG_HOME:-~/.config}/swob/wob.ini
+ echo >&2 "$0: no swob/wob.ini found; writing default to $wobini"
+ mkdir -p "${wobini%/*}"
cat >$wobini <<EOF
[style.volume]
background_color = 000000
+
[style.mute]
background_color = af0000
+
[style.brightness]
background_color = a89800
EOF
@@ -44,7 +47,7 @@ start_wob() {
# spawn wob process with temporary file(s)
(
- trap 'rm "$wobfifo" ${wobini_istemp:+"$wobini"}' 0
+ trap 'rm "$wobfifo"' 0
# Don't `exec' wob here, else the trap won't work
wob -c "$wobini" -v <$wobfifo
) &