This repository has been archived on 2021-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
2020-04-02 10:15:45 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# open a new tmux session
|
|
|
|
# or attach to existing sessions
|
|
|
|
|
|
|
|
sessions="$(tmux ls 2> /dev/null | awk '! /attached/ { sub(":", "", $1); print $1 ; }')"
|
|
|
|
[ ! "$sessions" ] && sessions="new" || sessions="$sessions\nnew"
|
2020-04-18 15:59:02 +00:00
|
|
|
choice=$(printf "%b" "$sessions" | dmenu -i -w 245 -p "Attach ")
|
2020-04-02 10:15:45 +00:00
|
|
|
[ ! "$choice" ] && exit
|
|
|
|
if [ "$choice" = "new" ]; then
|
2020-05-27 02:31:42 +00:00
|
|
|
$TERMINAL -e tmux
|
2020-04-02 10:15:45 +00:00
|
|
|
else
|
2020-05-27 02:31:42 +00:00
|
|
|
$TERMINAL -e tmux a -t "$choice"
|
2020-04-02 10:15:45 +00:00
|
|
|
fi
|