added bmux
This commit is contained in:
@@ -8,3 +8,4 @@ For POSIX shell compatible scripts, see the [sh-goodies](https://codeberg.org/lu
|
|||||||
|
|
||||||
* [YouStore](./ys): a way to securely store any set of files/directories inside a video
|
* [YouStore](./ys): a way to securely store any set of files/directories inside a video
|
||||||
* [1DLife](./1dlife): Jon Millen's 1D Game of Life in pure Bash
|
* [1DLife](./1dlife): Jon Millen's 1D Game of Life in pure Bash
|
||||||
|
* [bmux](./bmux): a simple, dmux-like session manager in Bash on top of just dtach
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# bmux: a simple terminal session switcher in Bash on top of dtach
|
||||||
|
# Created by Luxferre in 2026, released into the public domain
|
||||||
|
|
||||||
|
SDIR="$HOME/.dtsess"
|
||||||
|
SPFILE="$SDIR/.list"
|
||||||
|
mkdir -p "$SDIR"
|
||||||
|
touch "$SPFILE"
|
||||||
|
if [[ -z "$(ls -1 "$SDIR")" ]]; then
|
||||||
|
cat "$SPFILE" | while read -r sess; do
|
||||||
|
dtach -n "$SDIR/$sess" $SHELL
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
PS3='Select a session: '
|
||||||
|
mapfile -t MENU < "$SPFILE"
|
||||||
|
while true; do
|
||||||
|
select sname in "${MENU[@]}" New Quit; do break; done
|
||||||
|
[[ "$sname" = 'Quit' ]] && printf '\033[0m' && break
|
||||||
|
[[ "$sname" = 'New' ]] && read -r -p 'New session name: ' sname
|
||||||
|
[[ -n "$sname" ]] && printf '\033[0m' && dtach -A "$SDIR/$sname" $SHELL
|
||||||
|
ls -1 "$SDIR" > "$SPFILE"
|
||||||
|
mapfile -t MENU < "$SPFILE"
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user