You are not logged in.
Hi,
I use xfce-terminal 0.8.9.1
Is there a way to achieve this ?
Thanks
Offline
What do you mean by "dynamically change"?
If you are referring to the setting within terminal preferences, see https://docs.xfce.org/apps/xfce4-terminal/4.16/usage.
If you mean something like changing the terminal title to match the host of say a remote ssh connection, then each remote account that you connect to will need to have a similar PROMPT_COMMAND. For example:
PROMPT_COMMAND='printf "\033]0;host: %s\007" "${HOSTNAME%%.*}"'
Within xfce4-terminal settings, make sure you have dynamically set title enabled.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Thanks, the later is what I meant.
But can I keep my old PS1 too ?
Because I already have a hudge script to feed PROMPT_COMMAND:
[[ -t 0 ]] && stty -ctlecho # eviter ^C affiché dans le term
PURPLE=$(tput setaf 5)
RED=$(tput setaf 1)
WHITE=$(tput setaf 7)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
CYAN=$(tput setaf 4)
LIGHT_CYAN=$(tput setaf 6)
STOP=$(tput sgr0)
for int in eth{0..2} wlan0 ppp{0..2}; do
IP=$(/sbin/ifconfig 2>/dev/null $int | grep -oP 'inet\s+\K\d+\.\d+\.\d+\.\d+') && break
done
PROMPT_COMMAND=$(
» cat<<-'EOF'
» _temp_var=$val_ret _pipe_status="${PIPESTATUS[@]}"
» if((val_ret==0)); then
» » _temp_var=$(( $(tr -s " " "+" <<< "$_pipe_status") ))
» else
» » _temp_var=$val_ret
» fi
» if((_temp_var!=0)); then
» » if((EUID==0)); then
» » » PS1="\[$RED\]\u\[$YELLOW\]@\[$WHITE\]\h\[$CYAN\]:\[$GREEN\]\w\[$WHITE\]\[$GREEN\]|\[$RED\]ERROR:$_temp_var\[$GREEN\]|\[$WHITE\] # \[$STOP\]"
» » else
» » » PS1="\[$PURPLE\]\u\[$WHITE\]@\[$GREEN\]\h\[$GREEN\][\[$STOP\]${IP:-<UNDEF>}\[$GREEN\]]\[$WHITE\]:\[$GREEN\]\w|\[$RED\]ERROR:$_temp_var\[$GREEN\]|\[$WHITE\]$ $ \[$STOP\]"
» » fi
» else
» » if((EUID==0)); then
» » » PS1="\[$RED\]\u\[$YELLOW\]@\[$WHITE\]\h\[$CYAN\]:\[$GREEN\]\w\[$WHITE\] # \[$STOP\]"
» » else
» » » PS1="\[$PURPLE\]\u\[$WHITE\]@\[$GREEN\]\h\[$WHITE\]:\[$GREEN\]\w\[$WHITE\] $ \[$STOP\]"
» » fi
» fi
» EOF
Last edited by stardustOne (2022-10-27 02:29:13)
Offline
Try adding after that block the following:
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;host: %s\007" "${HOSTNAME%%.*}"'
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Thanks !
Offline
[ Generated in 0.012 seconds, 7 queries executed - Memory usage: 534.03 KiB (Peak: 534.88 KiB) ]