9f082b52b7
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>
129 lines
4.7 KiB
YAML
129 lines
4.7 KiB
YAML
# socktop-swipe configuration.
|
|
#
|
|
# Copy to ~/.config/socktop-swipe/config.yaml and edit. After every change run
|
|
#
|
|
# socktop-swipe validate
|
|
#
|
|
# which resolves the grid, prints the map and checks that every program it would
|
|
# run actually exists.
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Session
|
|
# ---------------------------------------------------------------------------
|
|
|
|
# tmux session name. Change only if it collides with something else.
|
|
session: socktop-swipe
|
|
|
|
# Terminal that `socktop-swipe run` opens the dashboard in. It is invoked as
|
|
# <terminal> -e tmux attach -t <session>
|
|
# Remove this line to attach in the current terminal instead.
|
|
terminal: alacritty
|
|
|
|
# Show a position indicator in the tmux status line: what is above, where you
|
|
# are, what is below. Useful once the grid has more than one row.
|
|
indicator: false
|
|
|
|
# Full paths to the monitor programs. i3 and non-login shells do not have
|
|
# ~/.cargo/bin on PATH, so setting them here saves repeating a path on every
|
|
# screen. A bare name is looked up on PATH. Leading ~/ is expanded.
|
|
binaries:
|
|
socktop: ~/.cargo/bin/socktop
|
|
uptime-kuma-status: ~/.cargo/bin/uptime-kuma-status
|
|
unifly: ~/Documents/GitHub/unifly/target/release-small/unifly
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Touch panel
|
|
# ---------------------------------------------------------------------------
|
|
|
|
touch:
|
|
# ALWAYS a /dev/input/by-id/ path -- eventN numbers get reshuffled on reboot
|
|
# or USB re-enumeration. `socktop-swipe doctor --list` shows the candidates.
|
|
device: /dev/input/by-id/usb-ILITEK_ILITEK-TOUCH-event-if00
|
|
|
|
# The PANEL's resolution, not the X screen. With a second monitor attached X
|
|
# reports the combined root window (e.g. 2304x720), which is not this.
|
|
width: 1280
|
|
height: 720
|
|
|
|
# Take the panel exclusively, so X never sees the touches. Without this, one
|
|
# swipe reaches several consumers at once: the terminal reads 2-contact swipes
|
|
# as pinch-zoom and socktop turns on its own all-motion mouse reporting. Set
|
|
# false only if you also want touch to work in other applications, and then
|
|
# install the X ignore rule instead -- see the README.
|
|
grab: true
|
|
|
|
# Pixels of travel before a drag counts as a swipe. Measured on the ILITEK
|
|
# panel: real swipes land at 150-260px, accidental contact under 70px.
|
|
threshold: 80
|
|
|
|
# Degrees off-axis tolerated, maximum 45. Real finger swipes came in 1-25
|
|
# degrees off true horizontal, so 30 leaves comfortable margin.
|
|
leniency: 30
|
|
|
|
# Contact counts accepted for one logical swipe.
|
|
#
|
|
# THE SETTING MOST LIKELY TO NEED CHANGING ON NEW HARDWARE. Many multipoint
|
|
# panels report 2 or even 3 contacts for a physically one-finger swipe. If
|
|
# swipes are detected but nothing happens, `socktop-swipe doctor` will say so
|
|
# in as many words.
|
|
fingers: [1, 2, 3]
|
|
|
|
# Swipe directions, named by finger motion. RL is right-to-left.
|
|
gestures:
|
|
forward: RL # move deeper into the grid
|
|
back: LR
|
|
up: DU
|
|
down: UD
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# The grid
|
|
# ---------------------------------------------------------------------------
|
|
#
|
|
# Each screen sits at "<row>x<col>". Row increases DOWNWARD, so "-1x0" is above
|
|
# "0x0" and "1x0" is below it. You start at "0x0".
|
|
#
|
|
# QUOTE THE COORDINATE. Unquoted, YAML reads 0x0 as the hexadecimal number 0.
|
|
#
|
|
# Coordinates are ordering, not slots: only their sort order matters, so "0x1"
|
|
# and "0x5" are interchangeable. You never have to count how many screens a
|
|
# socktop group produces in order to place the thing next to it.
|
|
#
|
|
# This example is the rack display:
|
|
#
|
|
# unifly -1x0
|
|
# |
|
|
# 4 Pis <-> orangepi + trixie 0x0, 0x1
|
|
# |
|
|
# uptime kuma 1x0
|
|
|
|
screens:
|
|
# Swipe UP from anywhere in row 0 to reach this.
|
|
- at: "-1x0"
|
|
type: unifly
|
|
|
|
# One cell, five screens: the four Pis tiled, then each Pi zoomed in turn.
|
|
- at: "0x0"
|
|
type: socktop
|
|
socktop_group: [rpi-master, rpi-worker-1, rpi-worker-2, rpi-worker-3]
|
|
layout: tiled
|
|
|
|
# Swipe forward past the last Pi to arrive here. socktop_group also accepts a
|
|
# comma-separated string, and layout takes any tmux layout name.
|
|
- at: "0x1"
|
|
type: socktop
|
|
socktop_group: "orangepi, trixie"
|
|
layout: even-vertical
|
|
|
|
# Swipe DOWN from row 0. Swiping back up returns to the exact host you left.
|
|
- at: "1x0"
|
|
type: uptime-kuma-status
|
|
url: https://status.wittyoneoff.com/status/wittyoneoff
|
|
|
|
# Anything else you want on a screen. `command` works on any type, as an
|
|
# override; for `generic` it is the whole definition.
|
|
#
|
|
# - at: "1x1"
|
|
# type: generic
|
|
# title: logs
|
|
# command: journalctl -f -u k3s-agent
|