Add host groups (one tmux window per group) and lightdm --autologin

SOCKTOP_GROUPS splits hosts into ';'-separated groups, each its own tmux
window with an optional @layout. The carousel walks group overview -> each
pane zoomed -> next group overview. SOCKTOP_HOSTS still works as one group.

install.sh --autologin writes a lightdm.conf.d drop-in; uninstall removes it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jasonwitty
2026-08-28 09:53:39 -07:00
parent c5b8d04b84
commit 818b09762e
6 changed files with 184 additions and 51 deletions
+56 -18
View File
@@ -1,6 +1,7 @@
#!/bin/sh
# Build the socktop display session: one window, N tiled panes, one per host.
# Pane index order is the swipe order.
# Build the socktop display session: one tmux window per GROUP, one pane per
# host inside it. Window order and pane index order together are the swipe
# order (see socktop-swipe).
set -eu
# shellcheck source=config.env
@@ -8,29 +9,66 @@ for c in /usr/local/etc/socktop-swipe.env "$(dirname "$0")/config.env"; do
[ -r "$c" ] && . "$c" && break
done
: "${SOCKTOP_HOSTS:?no SOCKTOP_HOSTS -- is the config installed?}"
: "${SOCKTOP_GROUPS:=}"
: "${SOCKTOP_HOSTS:=}"
: "${SOCKTOP_SESSION:=socktop4}"
: "${SOCKTOP_BIN:=socktop}"
WIN="$SOCKTOP_SESSION:rack"
# Legacy form: SOCKTOP_HOSTS alone is a single tiled group.
if [ -z "$SOCKTOP_GROUPS" ]; then
: "${SOCKTOP_HOSTS:?no SOCKTOP_GROUPS or SOCKTOP_HOSTS -- is the config installed?}"
SOCKTOP_GROUPS=$SOCKTOP_HOSTS
fi
tmux kill-session -t "$SOCKTOP_SESSION" 2>/dev/null || true
first=1
for h in $SOCKTOP_HOSTS; do
if [ "$first" = 1 ]; then
tmux new-session -d -s "$SOCKTOP_SESSION" -n rack "$SOCKTOP_BIN -P $h"
first=0
else
# Split the most recently created pane so creation order == index order.
tmux split-window -t "$WIN" "$SOCKTOP_BIN -P $h"
fi
# Label the pane with the host it is showing.
tmux select-pane -t "$WIN.$(tmux display-message -t "$WIN" -p '#{pane_index}')" -T "$h"
done
# Pane titles are set on the session, so do it up front; windows inherit.
build_group() {
# $1 = window name, remaining args = host names and an optional @layout
name=$1
shift
layout=tiled
hosts=
for tok in "$@"; do
case "$tok" in
@*) layout=${tok#@} ;;
*) hosts="$hosts $tok" ;;
esac
done
# shellcheck disable=SC2086
set -- $hosts
[ $# -gt 0 ] || return 0
tmux select-layout -t "$WIN" tiled
tmux select-pane -t "$WIN.0"
if ! tmux has-session -t "$SOCKTOP_SESSION" 2>/dev/null; then
tmux new-session -d -s "$SOCKTOP_SESSION" -n "$name" "$SOCKTOP_BIN -P $1"
else
tmux new-window -d -t "$SOCKTOP_SESSION" -n "$name" "$SOCKTOP_BIN -P $1"
fi
win="$SOCKTOP_SESSION:$name"
tmux select-pane -t "$win.0" -T "$1"
shift
for h in "$@"; do
# Split the most recently created pane so creation order == index order.
tmux split-window -t "$win" "$SOCKTOP_BIN -P $h"
tmux select-pane -t "$win.$(tmux display-message -t "$win" -p '#{pane_index}')" -T "$h"
done
tmux select-layout -t "$win" "$layout"
tmux select-pane -t "$win.0"
}
n=0
old_ifs=$IFS
IFS=';'
for group in $SOCKTOP_GROUPS; do
IFS=$old_ifs
# shellcheck disable=SC2086
build_group "g$n" $group
n=$((n + 1))
IFS=';'
done
IFS=$old_ifs
tmux select-window -t "$SOCKTOP_SESSION:g0"
tmux set-option -t "$SOCKTOP_SESSION" pane-border-status top
tmux set-option -t "$SOCKTOP_SESSION" pane-border-format ' #{pane_title} '