mirror of
https://github.com/notwa/rc
synced 2024-11-05 04:29:03 -08:00
fix terminal title not being set in bash
This commit is contained in:
parent
3db4f62408
commit
0e4bc62986
1 changed files with 4 additions and 4 deletions
|
@ -24,15 +24,15 @@ _temporary_scope_() {
|
|||
local DECSET="h" SGR="m" # final characters of a command sequence
|
||||
local sanity="$CSI?$DECTCEM$DECSET"
|
||||
local color1="$CSI;--$SGR" color2="$CSI--;97$SGR" reset="$hide$CSI$SGR$show"
|
||||
local line1="$hide$title$sanity$color1$show $reset"
|
||||
local line2="$hide$color2$show$prompt$reset "
|
||||
local ret="$line1\\n$line2"
|
||||
local ret_okay="${ret//--/42}" ret_fail="${ret//--/41}" # green/red bg
|
||||
if [ "$t" = xterm ] || [ "$t" = screen ] || [ "$t" = tmux ]; then
|
||||
[ "$t" = tmux ] && title="$cwd" || title="$host: $cwd"
|
||||
title="${OSC}2;$title$BEL"
|
||||
sanity="$ESC$G0$USASCII$SI$sanity"
|
||||
fi
|
||||
local line1="$hide$title$sanity$color1$show $reset"
|
||||
local line2="$hide$color2$show$prompt$reset "
|
||||
local ret="$line1\\n$line2"
|
||||
local ret_okay="${ret//--/42}" ret_fail="${ret//--/41}" # green/red bg
|
||||
PROMPT_COMMAND="[ \$? = 0 ] && PS1=\$'$ret_okay' || PS1=\$'$ret_fail'"
|
||||
}; _temporary_scope_; unset -f _temporary_scope_
|
||||
|
||||
|
|
Loading…
Reference in a new issue