File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -84,14 +84,24 @@ setup_PS1() {
84
84
85
85
86
86
# tweaks
87
+ [[ ! -v TERM || " $TERM " == dummy ]] && return # terminal is too stupid
88
+
87
89
local rever=0 rgb=0 light=0 basic=0 short=0
88
90
89
- [[ ! -v TERM || " $TERM " == dummy ]] && return # terminal is too stupid
90
- [[ " $TERM " != xterm* ]] && basic=1
91
- [[ -v KONSOLE_VERSION ]] && rgb=1
92
- [[ -v XTERM_VERSION ]] && { rever=1; basic=1; }
93
- [[ -v TERM_PROGRAM || -v TERMINAL_EMULATOR || -v KATE_PID ]] && short=1
94
- [[ -v TERM_PROGRAM || -v TERMINAL_EMULATOR ]] && light=1
91
+ check_term () {
92
+ # sudo -> env vars will be cleared without -E option
93
+ local -n sudo=SUDO_UID konsole=KONSOLE_VERSION xterm=XTERM_VERSION \
94
+ vscode=TERM_PROGRAM idea=TERMINAL_EMULATOR kate=KATE_PID
95
+
96
+ [[ " $TERM " != xterm* || -v xterm ]] && basic=1
97
+ [[ -v xterm ]] && rever=1
98
+ [[ -v konsole || -v sudo ]] && rgb=1
99
+ [[ -v xterm || -v vscode || -v idea ]] && rgb=0
100
+ [[ -v vscode || -v idea || -v kate ]] && short=1
101
+ [[ -v vscode || -v idea ]] && light=1
102
+ }
103
+ check_term
104
+ unset -f check_term
95
105
96
106
if (( rever)) ; then
97
107
C[fdwhi]=' 30'
You can’t perform that action at this time.
0 commit comments