I discovered tmux
possibility recently and I'm using it inside yakuake
/konsole
(quake-like terminal). However, I have to launch tmux
manually every time I start my laptop or restart yakuake
.
How to launch tmux
–automatically– when yakuake
/konsole
start ?
Based on the Start tmux on every shell login article from the Archlinux wiki, you can start tmux
on your shell with the following code at the
Zsh
or Bash
Add in your zsh
or bash
configuration (usually ~/.zshrc
or ~/.bashrc
) the following code and restart your session:
function start_tmux() {
if type tmux &> /dev/null; then
#if not inside a tmux session, and if no session is started, start a new session
if [[ $HOST == "laptop" && -z "$TMUX" && -z $TERMINAL_CONTEXT ]]; then
(tmux -2 attach || tmux -2 new-session)
fi
fi
}
start_tmux
Fish
Add in your fish
configuration (usually ~/.config/fish/config.fish
) the following code and restart your session:
function start_tmux
if type tmux > /dev/null
#if not inside a tmux session, and if no session is started, start a new session
if test -z "$TMUX" ; and test -z $TERMINAL_CONTEXT
tmux -2 attach; or tmux -2 new-session
end
end
end
start_tmux