#!/bin/sh # abmux: a simple terminal session switcher on top of abduco, fzf and expect # Created by Luxferre in 2026, released into the public domain SPFILE="$HOME/.absess" touch "$SPFILE" if [ -z "$(abduco | tail -n +2)" ]; then cat "$SPFILE" | while read -r sess; do abduco -n "$sess" $SHELL done fi FTR='Select a session or create a new one' while true; do abduco | tail -n +2 | cut -f 3 | sort -u > "$SPFILE" slist="$(nl -nln -w1 -s' - ' "$SPFILE")" sname="$(printf '%s\nNew\nQuit\n' "$slist" | grep . | fzf --tac --footer="$FTR")" [ "$sname" = 'Quit' ] && break [ "$sname" = 'New' ] && read -r -p 'New session name: ' sname sname="$(echo "$sname" | sed -E 's/^[0-9]+\ -\ //')" if [ -n "$sname" ]; then expect -c "spawn abduco -A \"$sname\" $SHELL; send \"\014\"; interact" fi done