Enforce single-instance in socktop-gestures instead of documenting it
The documented restart was `pkill -x lisgd && socktop-gestures &`. pkill exits non-zero when it matches nothing, so `&&` short-circuits and the daemon silently does not start when none was running -- you swipe, get nothing, and reasonably blame the config change you just made. socktop-gestures exec'd lisgd with no guard, so nothing downstream caught it. Rather than only fixing the one-liner, move the invariant into the tool: it now exits non-zero if a daemon is already running, and --replace stops the old one first (waiting for it to actually exit). This is the failure the README itself flags as gotcha 3, so a false success there is expensive. Verified against a live daemon: refusal, --help, bad-option exit codes, and a clean pid handover under --replace with the carousel still working. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -80,10 +80,15 @@ Everything lives in **`/usr/local/etc/socktop-swipe.env`**. Edit it there, not i
|
||||
the repo copy. After changing it, restart the daemon and rebuild the session:
|
||||
|
||||
```sh
|
||||
pkill -x lisgd && socktop-gestures &
|
||||
socktop-gestures --replace & # restarts the daemon, running or not
|
||||
socktop-rack
|
||||
```
|
||||
|
||||
Use `--replace` rather than `pkill -x lisgd && socktop-gestures`: `pkill` exits
|
||||
non-zero when it matches nothing, so that one-liner silently starts **nothing**
|
||||
if no daemon was running — you would swipe, get no response, and reasonably
|
||||
blame the config change.
|
||||
|
||||
| Option | Default | What it does |
|
||||
| --- | --- | --- |
|
||||
| `SOCKTOP_HOSTS` | four Pi profiles | socktop profile names, **in swipe order**. Any count works; layout and carousel adapt. |
|
||||
@@ -113,6 +118,8 @@ systemctl --user enable --now socktop-swipe
|
||||
|
||||
Either way, **run exactly one gesture daemon**. lisgd does not grab the input
|
||||
device exclusively, so two instances make every swipe fire twice.
|
||||
`socktop-gestures` enforces this: it exits non-zero if one is already running,
|
||||
unless given `--replace`.
|
||||
|
||||
## Uninstall
|
||||
|
||||
@@ -160,6 +167,10 @@ Also ensure tmux mouse mode is **off**; `socktop-rack` sets this.
|
||||
|
||||
Two lisgd instances are running. `pgrep -x lisgd` should show exactly one.
|
||||
|
||||
`socktop-gestures` refuses to start if a daemon is already running, so this
|
||||
should not happen via the normal path; `--replace` restarts cleanly. It can
|
||||
still occur if lisgd was launched by hand.
|
||||
|
||||
### 4. Swipes do nothing at all
|
||||
|
||||
In order: is the session running (`tmux ls`)? Is the daemon running
|
||||
|
||||
Reference in New Issue
Block a user