diff options
| author | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2025-08-06 15:48:48 -0500 |
|---|---|---|
| committer | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2025-08-06 15:48:48 -0500 |
| commit | da59e4b84427f1add813a73472bee2d5b32c210d (patch) | |
| tree | 7d5dfc7e543cb08f3848625737f6eb64a58db18a /broot-sessionizer/menu.sh | |
| parent | 6cdf366f6c5f47410ecbe22d8678d06852dc47d9 (diff) | |
add projects menu
Diffstat (limited to 'broot-sessionizer/menu.sh')
| -rwxr-xr-x | broot-sessionizer/menu.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/broot-sessionizer/menu.sh b/broot-sessionizer/menu.sh new file mode 100755 index 0000000..f187992 --- /dev/null +++ b/broot-sessionizer/menu.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) + +get_nth_session() { + tmux list-sessions -F "#{session_name}" | sed -n "$1 p" +} + +switch_nth_session() { + printf "switch -t $(get_nth_session "$1")" +} + +tmux display-menu -T "#[align=centre]Projects" -x "#{window_width}" -y S \ + "Switch Project" p "run-shell '$SCRIPT_DIR/../minibuffer.sh -d $HOME $SCRIPT_DIR/launch.sh'" \ + "$(get_nth_session 1)" 1 "$(switch_nth_session 1)" \ + "$(get_nth_session 2)" 2 "$(switch_nth_session 2)" \ + "$(get_nth_session 3)" 3 "$(switch_nth_session 3)" \ + "$(get_nth_session 4)" 4 "$(switch_nth_session 4)" + |
