renamed dmux script (setup default tmux session) to default-tmux-session
and added an alias `dmux` to .bashrc
This commit is contained in:
@@ -27,7 +27,13 @@ alias dirs='dirs -v'
|
|||||||
|
|
||||||
alias bashsource='source ~/.bashrc'
|
alias bashsource='source ~/.bashrc'
|
||||||
|
|
||||||
## short forms for tmux commands
|
# short forms for tmux commands
|
||||||
|
|
||||||
|
## run script to setup default tmux session and then attach the session
|
||||||
|
## attaching the session needs to be done from the calling shell, otherwise
|
||||||
|
## the setup script will only terminate after detaching or killing the session
|
||||||
|
alias dmux='default-tmux-session && tmux attach'
|
||||||
|
|
||||||
alias tma='tmux attach'
|
alias tma='tmux attach'
|
||||||
alias tmd='tmux detach -P'
|
alias tmd='tmux detach -P'
|
||||||
|
|
||||||
|
|||||||
23
misc/scripts/default-tmux-session
Executable file
23
misc/scripts/default-tmux-session
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
SESSION='quak'
|
||||||
|
# dont forget the '-d' option, otherwise the rest of
|
||||||
|
# the commands will get executed after the session is closed
|
||||||
|
|
||||||
|
if $(tmux has-session -t ${SESSION}); then
|
||||||
|
echo "default session ${SESSION} already exists"
|
||||||
|
|
||||||
|
# return 1 to report error and abort the `dmux` alias
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
tmux new-session -d -s "$SESSION" -n "temp"
|
||||||
|
tmux new-window -t "$SESSION" -n "dotfiles" -c $HOME/dotfiles
|
||||||
|
tmux new-window -t "$SESSION" -n "docs" -c $HOME/collection
|
||||||
|
tmux new-window -t "$SESSION" -n "stuff" -c $HOME
|
||||||
|
tmux kill-window -t "temp"
|
||||||
|
|
||||||
|
# this causes the script to exit only, when the session is ended or detached
|
||||||
|
# it also causes the tmux detach command with hang up signal to fail
|
||||||
|
# therefore the following line is commented out and an alias setup in .bashrc
|
||||||
|
#tmux attach -t "$SESSION"
|
||||||
|
fi
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
SESSION='quak'
|
|
||||||
# dont forget the '-d' option, otherwise the rest of
|
|
||||||
# the commands will get executed after the session is closed
|
|
||||||
tmux new-session -d -s "$SESSION" -n "temp"
|
|
||||||
tmux new-window -t "$SESSION" -n "dotfiles" -c $HOME/dotfiles
|
|
||||||
tmux new-window -t "$SESSION" -n "docs" -c $HOME/collection
|
|
||||||
tmux new-window -t "$SESSION" -n "stuff" -c $HOME
|
|
||||||
tmux kill-window -t "temp"
|
|
||||||
tmux attach -t "$SESSION"
|
|
||||||
Reference in New Issue
Block a user