Condense term function
This commit is contained in:
parent
a7f7218b24
commit
37e7d8e4b3
9
neofetch
9
neofetch
|
@ -1739,6 +1739,9 @@ getfont () {
|
||||||
# Terminal Emulator {{{
|
# Terminal Emulator {{{
|
||||||
|
|
||||||
getterm () {
|
getterm () {
|
||||||
|
# Check $PPID for terminal emulator.
|
||||||
|
case "$os" in
|
||||||
|
"Mac OS X")
|
||||||
# Workaround for OS X systems that
|
# Workaround for OS X systems that
|
||||||
# don't support the block below.
|
# don't support the block below.
|
||||||
case "$TERM_PROGRAM" in
|
case "$TERM_PROGRAM" in
|
||||||
|
@ -1746,10 +1749,9 @@ getterm () {
|
||||||
"Terminal.app") term="Apple Terminal" ;;
|
"Terminal.app") term="Apple Terminal" ;;
|
||||||
*) term="${TERM_PROGRAM/\.app}" ;;
|
*) term="${TERM_PROGRAM/\.app}" ;;
|
||||||
esac
|
esac
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
|
||||||
# Check $PPID for terminal emulator.
|
|
||||||
if [ -z "$term" ]; then
|
|
||||||
case "$os" in
|
|
||||||
"Windows")
|
"Windows")
|
||||||
parent="$(ps -p ${1:-$PPID} | awk '{printf $2}')"
|
parent="$(ps -p ${1:-$PPID} | awk '{printf $2}')"
|
||||||
parent=${parent/'PPID'}
|
parent=${parent/'PPID'}
|
||||||
|
@ -1771,7 +1773,6 @@ getterm () {
|
||||||
"ruby" | "1" | "systemd" | "sshd") unset term ;;
|
"ruby" | "1" | "systemd" | "sshd") unset term ;;
|
||||||
*) term="$name" ;;
|
*) term="$name" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
Reference in New Issue