From 4ecb2743df7c92097dda0f52b48e8dffb2a4f5fb Mon Sep 17 00:00:00 2001 From: wick3dr0se Date: Fri, 24 Dec 2021 09:56:00 -0600 Subject: [PATCH] try new method to get term #69 --- sys/linux.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/linux.sh b/sys/linux.sh index 21572c7..105590f 100644 --- a/sys/linux.sh +++ b/sys/linux.sh @@ -47,11 +47,15 @@ is "$distro" *"Arch"* && distro="$distro (btw)" # taken from uname # /TERM/ get terminal from 2nd field of pstree output (need new method) -comm pstree && term=$(pstree -sA $$ | awk -F--- '{print $2 ; exit}') -term=${term/-/ } +shell=${SHELL##*/} +while read -r line ; do + case $line in + '`-'*) line=${line#\`-*} ; term=${line%%-+-*} ;; + esac +done < <(pstree | grep "$shell") # /SHELL/ check shell environment variable -var $SHELL && shell=${SHELL##*/} +# taken above in /TERM/ # /DE/WM/ get desktop environment or window manager if var $XDG_CURRENT_DESKTOP ; then