Added helper function gp_set_window_title that can be used to set XTerm window title to the given argument. Used in TruncatedPwd_WindowTitle theme

master
oGre 10 years ago
parent 5098924db8
commit 1ba48fd06b
  1. 5
      gitprompt.sh
  2. 7
      themes/TruncatedPwd_WindowTitle.bgptheme
  3. 7
      themes/TruncatedPwd_WindowTitle_NoExitState.bgptheme

@ -525,6 +525,11 @@ function is_function {
declare -Ff "$1" >/dev/null;
}
#Sets the window title to the given argument string
function gp_set_window_title {
echo -ne "\033]0;"$@"\007"
}
function prompt_callback_default {
return
}

@ -23,11 +23,6 @@
override_git_prompt_colors() {
GIT_PROMPT_THEME_NAME="TruncatedPwd_WindowTitle"
#Sets the window title to the given argument string
function gp_set_title {
echo -ne "\033]0;"$@"\007"
}
#Helper function that truncates $PWD depending on window width
function gp_truncate_pwd {
local newPWD="${PWD/#$HOME/~}"
@ -39,7 +34,7 @@ override_git_prompt_colors() {
#Overrides the prompt_callback function used by bash-git-prompt
function prompt_callback {
local PS1="\u@\h: $(gp_truncate_pwd)"
gp_set_title $PS1
gp_set_window_title "$PS1"
echo -n "[${PS1}]${ResetColor}"
}

@ -23,11 +23,6 @@
override_git_prompt_colors() {
GIT_PROMPT_THEME_NAME="TruncatedPwd_WindowTitle_NoExitState"
#Sets the window title to the given argument string
function gp_set_title {
echo -ne "\033]0;"$@"\007"
}
#Helper function that truncates $PWD depending on window width
function gp_truncate_pwd {
local newPWD="${PWD/#$HOME/~}"
@ -39,7 +34,7 @@ override_git_prompt_colors() {
#Overrides the prompt_callback function used by bash-git-prompt
function prompt_callback {
local PS1="\u@\h: $(gp_truncate_pwd)"
gp_set_title $PS1
gp_set_window_title $PS1
echo -n "[${PS1}]${ResetColor}"
}

Loading…
Cancel
Save