-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrofi-tmux
executable file
·31 lines (25 loc) · 965 Bytes
/
rofi-tmux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# __ _ _
# _ __ ___ / _(_) | |_ _ __ ___ _ ___ __
# | '__/ _ \| |_| | | __| '_ ` _ \| | | \ \/ /
# | | | (_) | _| | | |_| | | | | | |_| |> <
# |_| \___/|_| |_| \__|_| |_| |_|\__,_/_/\_\
# Github: https://github.com/TechnicalDC/dc-scripts
function tmux_sessions()
{
tmux list-session | sed 's/: /| /' | column -t -s'|' -o' | '
}
ADD=" Add new session"
DELETE=" Delete a session"
QUIT=" Quit"
TMUX_SESSION=$( (printf "%s\n" "$ADD" "$DELETE" "$QUIT"; tmux_sessions) | rofi -theme ~/.config/rofi/themes/catppuccin-macchiato.rasi -dmenu -p " tmux " -no-show-icons)
if [[ "$ADD" = "$TMUX_SESSION" ]]; then
rofi-sensible-terminal -e tmux new-session &
elif [[ "$DELETE" = "$TMUX_SESSION" ]]; then
tmux kill-session
elif [[ "$QUIT" = "$TMUX_SESSION" ]]; then
exit
elif [[ "$TMUX_SESSION" != "" ]] ; then
SESSION=$(echo $TMUX_SESSION | cut -d\ -f1)
rofi-sensible-terminal -e tmux attach -t "${SESSION}" &
fi