2021-04-07 15:40:59 +03:00
|
|
|
#!/bin/zsh
|
|
|
|
|
2024-02-28 23:22:33 +03:00
|
|
|
z-orig-term() {
|
2021-04-07 15:40:59 +03:00
|
|
|
local -a a
|
2022-07-19 02:41:45 +03:00
|
|
|
local i x
|
|
|
|
|
2021-04-07 15:40:59 +03:00
|
|
|
for i ( ${ZSHU_PARENTS_PID} ) ; do
|
2024-03-04 15:35:55 +03:00
|
|
|
i="${ZSHU[procfs]}/$i/environ"
|
|
|
|
[ -r "$i" ] || continue
|
|
|
|
x=$(sed -zEn '/^TERM=(.+)$/{s//\1/;p;}' "$i" 2>/dev/null | tr -d '\0')
|
2021-04-07 15:40:59 +03:00
|
|
|
[ -n "$x" ] || continue
|
|
|
|
a+=( "$x" )
|
|
|
|
done
|
2024-02-28 23:22:33 +03:00
|
|
|
case "$1" in
|
|
|
|
\* | @ )
|
|
|
|
local ORIG_TERM=( $a )
|
|
|
|
declare -p ORIG_TERM
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
i='-1' ; x="${1:-$i}"
|
|
|
|
echo "${a[$x]}"
|
|
|
|
;;
|
|
|
|
esac
|
2021-04-07 15:40:59 +03:00
|
|
|
}
|