1
0
dotfiles/.config/zsh/rc/terminal.zsh
2024-02-28 23:22:33 +03:00

24 lines
474 B
Bash

#!/bin/zsh
z-orig-term() {
local -a a
local i x
for i ( ${ZSHU_PARENTS_PID} ) ; do
[ -r "/proc/$i/environ" ] || continue
x=$(sed -zEn '/^TERM=(.+)$/{s//\1/;p;}' "/proc/$i/environ" 2>/dev/null | tr -d '\0')
[ -n "$x" ] || continue
a+=( "$x" )
done
case "$1" in
\* | @ )
local ORIG_TERM=( $a )
declare -p ORIG_TERM
;;
* )
i='-1' ; x="${1:-$i}"
echo "${a[$x]}"
;;
esac
}