Last active
November 29, 2020 19:00
-
-
Save yzdann/a76ea51a269d748813f587d80dfa299c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TMUX_WINDOW_ID=$(wmctrl -l | grep -i tmux | grep -i konsole | awk "/$rx/"'{print $1}' | head -1 ) | |
TMUX_CURRENT_FIRST_SESSION=$(tmux list-session | cut -d':' -f1 | head -1) | |
echo $TMUX_WINDOW_ID | |
# activate the window terminal with tmux if existed | |
if [[ ! -z "$TMUX_WINDOW_ID" ]]; then | |
wmctrl -i -a $TMUX_WINDOW_ID | |
else | |
# attach to current session | |
if [[ ! -z "$TMUX_CURRENT_FIRST_SESSION" ]]; then | |
konsole -e "tmux attach -t $TMUX_CURRENT_FIRST_SESSION" | |
else | |
konsole -e tmux | |
fi | |
fi | |
tmux new-window |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment