Files
socktop-swipe/notes/V1-BASH.md
T

49 lines
2.4 KiB
Markdown
Raw Normal View History

# What v1 was
v1 was three POSIX shell scripts plus a `.env` file, installed to
`/usr/local/bin`. Tagged **`v1.2`** — `git show v1.2` has the whole thing, and it
still works.
- `socktop-rack` built a tmux session: one window per group, one pane per host.
- `socktop-swipe next|prev|down|up` walked a linear carousel, re-deriving its
position from tmux on every single invocation.
- `socktop-gestures` wrapped [lisgd](https://git.sr.ht/~mil/lisgd) with the right
arguments and enforced a single instance.
- `config.env` at `/usr/local/etc/socktop-swipe.env` held `SOCKTOP_GROUPS`,
`SOCKTOP_AUX_CMD`, `TOUCH_DEV` and the gesture tuning.
It worked well for a year on the rack display. What made it worth replacing:
- **The layout was hard-coded as one line.** Groups ran left to right and that
was the only shape available. The swipe-down "aux screen" existed because there
was nowhere else to put a second kind of monitor — a special case bolted on,
not a position in a layout.
- **Every new monitor type was another special case.** `SOCKTOP_AUX_CMD` is a
single command with no type, no parameters and no room for a second one.
- **The navigation logic could not be tested.** It lived in a shell script that
queried a live tmux server, so the only way to check a change was to install it
on the display and swipe.
## Migration
There is no converter — deliberately, for a project with one known deployment.
The mapping is direct:
| v1 | v2 |
| --- | --- |
| `SOCKTOP_GROUPS="a b ; c d @even-vertical"` | one `type: socktop` screen per group, at `"0x0"`, `"0x1"`, …, with `socktop_group` and `layout` |
| `SOCKTOP_AUX_CMD="… uptime-kuma-status URL"` | a `type: uptime-kuma-status` screen at `"1x0"` |
| `SOCKTOP_BIN` | `binaries: socktop:` |
| `TOUCH_DEV` | `touch.device` |
| `SCREEN_W` / `SCREEN_H` | `touch.width` / `touch.height` |
| `SWIPE_THRESHOLD` / `SWIPE_LENIENCY` | `touch.threshold` / `touch.leniency` |
| `FINGER_COUNTS="1 2 3"` | `touch.fingers: [1, 2, 3]` |
| `GESTURE_IN` / `GESTURE_OUT` | `gestures.forward` / `gestures.back` |
| `GESTURE_AUX_IN` / `GESTURE_AUX_OUT` | `gestures.down` / `gestures.up` |
| the X `Option "Ignore"` rule | `touch.grab: true` |
| `remain-on-exit` | the pane keep-alive wrapper (see DESIGN.md) |
Run `./uninstall.sh` from a v1 checkout first, or remove
`/usr/local/bin/socktop-{rack,swipe,gestures}` and
`/usr/local/etc/socktop-swipe.env` by hand.