← Back to Upcase

Different default console layouts for different terminals?


(Zerophase) #1

I use different terminals depending on what I’m doing. If it’s system management generally I end up using Guake, for kernel compilation Terminator generally gets used, and for coding I use JetBrains suite of products. Currently, how I have everything setup the default layout I prefer for Guake ends up getting used by CLion or RubyMine. Is setting up different sessions in .tmux.conf, and in .zshrc loading those sessions based on the terminal the prefered way to handle this?

I’m mainly not sure how to properly determine with terminal emulator zsh is running in. The $TERM variable would just give screen-256color.


(Zerophase) #2

Found a solution that more or less works. Might break for some terminal emulators.

[code]
_not_inside_tmux() { [[ -z “$TMUX” ]]}

function getTerminalEmulatorName()
{
echo (basename "/"(ps -f -p (cat /proc/(echo $$)/stat
| cut -d \ -f 4) | tail -1 | sed ‘s/^.* //’))
}

start_tmuxSession()
{
if _not_inside_tmux; then
terminal=$( getTerminalEmulatorName )
if [[ terminal == *"guake"* ]]; then tmux -2 new-session -A -n Dropdown -s Command #paneCount=(tmux list-panes -t “Command” | wc -l)
#if (( $paneCount < 2 )); then
# tmux split-window -h -p 50 -t 0
#fi
elif [[ $terminal == “intellij” ]]; then
tmux -2 new-session -A -n Console -s Intellij
fi
fi
}[/code]