Initial commit: swipe-to-zoom touchscreen navigation for socktop

Tiled socktop dashboard where a right-to-left swipe zooms into each host
full-screen and left-to-right walks back out.

The carousel is tmux pane zoom rather than separate socktop instances, so
there is one process per host: half the processes, no reconnect delay when
swiping back, and constant polling load on the monitored hosts.

Gestures come from lisgd because libinput emits gesture events only for
touchpads, never touchscreens, which rules out libinput-gestures entirely.

Documents the four gotchas found while building this: panels reporting 2-3
contacts for a one-finger swipe, X needing to ignore the panel so the
terminal and socktop stop competing for the same touches, tmux mouse mode
being incompatible with swipes, and lisgd not grabbing the device
exclusively so two instances double-fire.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
jasonwitty
2026-08-09 01:22:23 -07:00
commit 18ddd39184
11 changed files with 735 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
# socktop-swipe configuration.
#
# Installed to /usr/local/etc/socktop-swipe.env. Every script reads that file if
# it exists, so edit it there on the display host -- not this copy in the repo.
# After editing, restart the gesture daemon and rebuild the session (see README).
#
# Values use ${VAR:-default} so an environment variable of the same name always
# wins over this file. That keeps the file editable in the obvious way while
# still allowing one-off overrides, e.g. SOCKTOP_SESSION=test socktop-rack
# ---------------------------------------------------------------------------
# What to monitor
# ---------------------------------------------------------------------------
# socktop profile names (from ~/.config/socktop/profiles.json), in swipe order.
# The first is what you land on after one right-to-left swipe from the overview.
# Any count works; the tiled layout and the carousel adapt automatically.
SOCKTOP_HOSTS="${SOCKTOP_HOSTS:-rpi-master rpi-worker-1 rpi-worker-2 rpi-worker-3}"
# tmux session name. Change only if it collides with something else.
SOCKTOP_SESSION="${SOCKTOP_SESSION:-socktop4}"
# Absolute path to the socktop binary. i3 and non-login shells do not have
# ~/.cargo/bin on PATH, so a full path is safer than relying on lookup.
SOCKTOP_BIN="${SOCKTOP_BIN:-$HOME/.cargo/bin/socktop}"
# ---------------------------------------------------------------------------
# Touch panel
# ---------------------------------------------------------------------------
# The touchscreen event device. ALWAYS prefer a /dev/input/by-id/ symlink --
# /dev/input/eventN numbers get reshuffled on reboot or USB re-enumeration.
# Find yours with: tools/find-device.sh
TOUCH_DEV="${TOUCH_DEV:-/dev/input/by-id/usb-ILITEK_ILITEK-TOUCH-event-if00}"
# The touch panel's own resolution -- NOT the X screen size. lisgd otherwise
# asks X, which reports the full root window across all monitors (e.g. 2304x720
# with a second display attached) and skews its edge and distance maths.
SCREEN_W="${SCREEN_W:-1024}"
SCREEN_H="${SCREEN_H:-600}"
# ---------------------------------------------------------------------------
# Gesture tuning
# ---------------------------------------------------------------------------
# Pixels of travel before a drag counts as a swipe. Too low and stray contact
# triggers it; too high and normal swipes are ignored. Measured on the ILITEK
# panel: real swipes land at 150-260px, accidental ones under 70px.
SWIPE_THRESHOLD="${SWIPE_THRESHOLD:-80}"
# Degrees of leniency off the axis, max 45. Real finger swipes came in 1-25
# degrees off true horizontal, so 30 leaves comfortable margin.
SWIPE_LENIENCY="${SWIPE_LENIENCY:-30}"
# Contact counts to accept for one logical swipe.
#
# THIS IS THE SETTING THAT MOST OFTEN NEEDS CHANGING ON NEW HARDWARE. Many
# multipoint panels report 2 or even 3 contacts for what is physically a
# one-finger swipe (palm, or ghost contacts). If gestures are recognised but
# never fire, run tools/diag.sh and compare Cfg(f=N) against Evt(f=N).
FINGER_COUNTS="${FINGER_COUNTS:-1 2 3}"
# Swipe directions. RL = right-to-left = zoom in; LR = left-to-right = zoom out.
# Swap these two values to reverse the direction of travel.
GESTURE_IN="${GESTURE_IN:-RL}"
GESTURE_OUT="${GESTURE_OUT:-LR}"