Files
socktop-swipe/Cargo.toml
T
jasonwitty 9f082b52b7 Rust core: YAML grid config, navigation state machine, evdev input
Replaces the three shell scripts' logic with one binary. tmux stays the
pane engine; src/session/ is the only module that knows that.

The grid model: coordinates are sparse ordinals, so only their sort order
matters and a socktop group is one cell however many hosts it holds.
Horizontal movement walks a cell's sub-sequence (tiled overview, then each
host zoomed) and leaves only after the last one; entry direction decides
whether you land on the first or last sub-screen. Vertical movement returns
to where you were in that row, and snaps to the nearest column only on the
first visit.

Notable details found while building:

* Unquoted "at: 0x0" is hexadecimal 0 to YAML, and "1x0" is not valid hex,
  so only the row-0 entries would break. Deserialization catches the integer
  case and names the fix.
* Panes are addressed by tmux id, never index, and each command is wrapped
  so the pane outlives it. v1's remain-on-exit cannot do this: it is a
  per-window option that new windows do not inherit, so a monitor that exits
  during construction destroys its window and the next split fails with
  "no current target". Now a dead monitor stays on screen with its status.
* Contact-count averaging, not summing: a panel reporting one finger as
  three contacts must not look like three times the travel.
* Movement subcommands wait for the move to happen and report where they
  landed, so they are scriptable rather than fire-and-forget.

36 tests: the grid model, the gesture classifier and an end-to-end pass
against a real tmux server.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-09 13:01:08 -07:00

56 lines
1.5 KiB
TOML

[package]
name = "socktop-swipe"
version = "2.0.0-dev"
edition = "2021"
rust-version = "1.82"
description = "Swipe-to-zoom touchscreen navigation for a wall-mounted socktop dashboard"
repository = "https://gt.wittyoneoff.com/jason/socktop-swipe"
license = "Apache-2.0"
readme = "README.md"
keywords = ["tui", "touchscreen", "tmux", "dashboard", "socktop"]
categories = ["command-line-utilities"]
[dependencies]
anyhow = "1"
clap = { version = "4", features = ["derive"] }
evdev = "0.12"
serde = { version = "1", features = ["derive"] }
serde_yaml = "0.9"
shell-words = "1"
[profile.release]
opt-level = "s"
lto = true
codegen-units = 1
strip = true
panic = "abort"
# `cargo deb` produces a package with these paths. Not used yet -- see
# notes/PLAN-v2.md, distribution is source-only for v2.0.
[package.metadata.deb]
maintainer = "Jason Witty"
depends = "tmux"
recommends = "alacritty"
extended-description = """\
Drives a grid of terminal dashboards on a touchscreen. Swipe between socktop \
hosts, an Uptime Kuma status page, a unifly UniFi TUI or any command you like. \
Reads the touch panel directly via evdev and lays the screens out with tmux."""
assets = [
["target/release/socktop-swipe", "usr/bin/", "755"],
["config.example.yaml", "usr/share/doc/socktop-swipe/", "644"],
["README.md", "usr/share/doc/socktop-swipe/", "644"],
["packaging/70-socktop-swipe.rules", "lib/udev/rules.d/", "644"],
]
[lib]
name = "socktop_swipe"
path = "src/lib.rs"
[[bin]]
name = "socktop-swipe"
path = "src/main.rs"
[dev-dependencies]
shell-words = "1"
serde_yaml = "0.9"