diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-18 17:07:37 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-18 17:07:37 +0200 |
| commit | b5a767997db71e9927c1f89c0e7ead6ee7e45edb (patch) | |
| tree | 4ad023c20de7c1a6dc2c4a770deafb6378eabd7e /breaktimer.sh | |
| parent | f32084dad7d0b9773cd5234b30a21b013e789f34 (diff) | |
| download | breaktimer-b5a767997db71e9927c1f89c0e7ead6ee7e45edb.tar.gz breaktimer-b5a767997db71e9927c1f89c0e7ead6ee7e45edb.zip | |
feat: read overrides from breaktimer.conf
Every tunable was a variable in a tracked script, so a personal value could
only live as an uncommittable edit. The repository copy and the installed
copy had already drifted over three sound paths pointing into a home
directory, which is the argument in one line.
Bash sources files natively: no format, no parser, and a syntax error is a
bash error at start rather than a silent fallback to a default.
Diffstat (limited to 'breaktimer.sh')
| -rwxr-xr-x | breaktimer.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/breaktimer.sh b/breaktimer.sh index 9a9c5fa..7c8bfa3 100755 --- a/breaktimer.sh +++ b/breaktimer.sh @@ -47,6 +47,14 @@ SYS_SOUND_LONG="$SOUND_DIR/alarm-clock-elapsed.oga" SYS_SOUND_BACK="$SOUND_DIR/service-login.oga" # ------------------------------------ +# Overrides, if any. Bash sources files natively, so there is no format and no +# parser: a syntax error here is a bash error at start, on stderr, which is the +# loudest possible failure and the right one. Read once, here, which means a +# change needs `breaktimer.sh restart` to take effect. The `run` subcommand +# re-execs this script through setsid, so the daemon reads it too. +CONFIG_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/breaktimer.conf" +[ -f "$CONFIG_FILE" ] && . "$CONFIG_FILE" + RUNTIME="${XDG_RUNTIME_DIR:-/tmp}" PID_FILE="$RUNTIME/breaktimer.pid" STATE_FILE="$RUNTIME/breaktimer.state" # running|paused |
