diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index eb13a7603..c15c6d797 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -9,13 +9,26 @@ if (( $+commands[tmux] )); then zstyle -a :omz:plugins:autostart state [[ state == "on" && -z $TMUX ]] && exec tmux + # start an irc client in a tmux session if [[ -n $IRC ]]; then irc() { if tmux has -t irc >/dev/null; then - tmux switch -t irc + [[ -n $TMUX ]] && tmux switch -t irc || tmux attach -t irc else TMUX="" tmux new -ds irc $IRC[1] - tmux switch -t irc + [[ -n $TMUX ]] && tmux switch -t irc || tmux attach -t irc + fi + } + fi + + # start rtorrent in a tmux session + if [[ -n $RTORRENT ]]; then + torrents() { + if tmux has -t torrents >/dev/null; then + [[ -n $TMUX ]] && tmux switch -t torrents || tmux attach -t torrents + else + TMUX="" tmux new -ds torrents $RTORRENT[1] + [[ -n $TMUX ]] && tmux switch -t torrents || tmux attach -t torrents fi } fi