18ddd39184
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>
52 lines
1.5 KiB
Bash
Executable File
52 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
# Touch gesture daemon for the socktop display. Pass -v to log each detection.
|
|
#
|
|
# Single source of truth for the lisgd arguments -- referenced by the i3 autostart,
|
|
# the systemd unit and tools/test-foreground.sh, so they cannot drift apart.
|
|
#
|
|
# IMPORTANT: run exactly ONE instance. lisgd does not grab the input device
|
|
# exclusively, so two running copies make every swipe fire twice.
|
|
set -eu
|
|
|
|
for c in /usr/local/etc/socktop-swipe.env "$(dirname "$0")/config.env"; do
|
|
[ -r "$c" ] && . "$c" && break
|
|
done
|
|
|
|
: "${TOUCH_DEV:?no TOUCH_DEV -- is the config installed?}"
|
|
: "${SCREEN_W:=1024}"
|
|
: "${SCREEN_H:=600}"
|
|
: "${SWIPE_THRESHOLD:=80}"
|
|
: "${SWIPE_LENIENCY:=30}"
|
|
: "${FINGER_COUNTS:=1 2 3}"
|
|
: "${GESTURE_IN:=RL}"
|
|
: "${GESTURE_OUT:=LR}"
|
|
|
|
SWIPE_CMD=${SWIPE_CMD:-$(dirname "$0")/socktop-swipe}
|
|
[ -x /usr/local/bin/socktop-swipe ] && SWIPE_CMD=/usr/local/bin/socktop-swipe
|
|
|
|
verbose=
|
|
[ "${1:-}" = "-v" ] && verbose=-v
|
|
|
|
if [ ! -e "$TOUCH_DEV" ]; then
|
|
echo "socktop-gestures: $TOUCH_DEV not present" >&2
|
|
exit 1
|
|
fi
|
|
if [ ! -r "$TOUCH_DEV" ]; then
|
|
echo "socktop-gestures: cannot read $TOUCH_DEV -- are you in the 'input' group?" >&2
|
|
echo " sudo usermod -aG input $(id -un) then log out and back in" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Bind every configured contact count to the same action; see config.env for why.
|
|
set --
|
|
for f in $FINGER_COUNTS; do
|
|
set -- "$@" -g "$f,$GESTURE_IN,*,*,R,$SWIPE_CMD next"
|
|
set -- "$@" -g "$f,$GESTURE_OUT,*,*,R,$SWIPE_CMD prev"
|
|
done
|
|
|
|
exec lisgd $verbose \
|
|
-d "$TOUCH_DEV" \
|
|
-w "$SCREEN_W" -h "$SCREEN_H" \
|
|
-t "$SWIPE_THRESHOLD" -r "$SWIPE_LENIENCY" \
|
|
"$@"
|