iTerm2 detection

This commit is contained in:
Dylan Araps 2016-05-16 22:41:40 +10:00
parent e223b034ef
commit 6a96072efe

View file

@ -1738,13 +1738,18 @@ getfont () {
# Terminal Emulator {{{ # Terminal Emulator {{{
getterm () { getterm () {
parent="$(ps -p ${1:-$PPID} -o ppid=)" [ -n "$ITERM_PROFILE" ] && term="iTerm2"
name="$(ps -p $parent -o comm=)"
case "$name" in # Check $PPID for terminal emulator.
"${SHELL/*\/}" | *"sh" | "tmux") getterm "$parent" ;; if [ -z "$term" ]; then
*) term="$name" ;; parent="$(ps -p ${1:-$PPID} -o ppid=)"
esac name="$(ps -p $parent -o comm=)"
case "$name" in
"${SHELL/*\/}" | *"sh" | "tmux") getterm "$parent" ;;
*) term="$name" ;;
esac
fi
} }
# }}} # }}}