diff options
| author | 2024-12-21 20:13:57 +0000 | |
|---|---|---|
| committer | 2025-01-25 13:44:13 +0000 | |
| commit | e896b4aa2fa981287aa8804ef4041e798e308eb7 (patch) | |
| tree | e7df4c3ce0ad263d9e2840cef70b623d52d3d647 | |
| parent | b08d5cd6b2081000fb49c8e8bd135cb656aad95d (diff) | |
Allow a user to configure audio type to skip detection
This should make swob a bit faster for eg. ALSA users (without pipewire nor
pulse), at the cost of it checking config directories all the time rather
than only when it starts wob. Really the check should be moved to the daemon
side, the daemon should be a shellscript which calls set_vol and feeds it
to wob, and the controller should just echo "$*" >$wobfifo. That's an idea
| -rwxr-xr-x | swob.sh | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -4,16 +4,24 @@ set ${BASH_VERSION:+-o pipefail} -efu wobfifo=$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY.swob -wobini= +wobini= SWOB_AUDIO= -set_wobini() { +scan_confdirs() { for dir in ${XDG_CONFIG_HOME:+"$XDG_CONFIG_HOME"} ~/.config /etc "${0%/*}"/../etc; do - if test -r "$dir"/swob/wob.ini; then + test -d "$dir"/swob || continue + if test -z "$wobini" -a -r "$dir"/swob/wob.ini; then wobini=$dir/swob/wob.ini + fi + if test -z "$SWOB_AUDIO" -a -r "$dir"/swob/audio; then + SWOB_AUDIO=`cat "$dir"/swob/audio` + fi + if test -n "$wobini" -a -n "$SWOB_AUDIO"; then return fi done +} +new_wobini() { # fine, I will make my own wob.ini(5) wobini=${XDG_CONFIG_HOME:-~/.config}/swob/wob.ini echo >&2 "$0: no swob/wob.ini found; writing default to $wobini" @@ -41,7 +49,7 @@ start_wob() { # or any other IPC or SHM system mkfifo -m600 "$wobfifo" - set_wobini + test -n "$wobini" || new_wobini # spawn wob process with temporary file(s) { @@ -158,6 +166,7 @@ do_cmd_get_percent() { ## MAIN ## +scan_confdirs start_wob { |
