根据Archlinux wiki 中的Start tmux on every shell Logintmux文章,您可以使用以下代码在 shell 上启动:
Zsh或者Bashzsh在您的或bash配置(通常~/.zshrc是 或)中添加~/.bashrc以下代码并重新启动会话:
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
Run Code Online (Sandbox Code Playgroud)
Fish在您的配置中添加fish(通常~/.config/fish/config.fish)以下代码并重新启动会话:
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
Run Code Online (Sandbox Code Playgroud)
朋友建议使用<terminal_emulator> -e tmux。
它适用于konsole.
我将菜单中的属性修改为:
konsole -e tmux
Run Code Online (Sandbox Code Playgroud)
但是它不适用于yakuake.
| 归档时间: |
|
| 查看次数: |
5613 次 |
| 最近记录: |