summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.bashrc25
1 files changed, 13 insertions, 12 deletions
diff --git a/.bashrc b/.bashrc
index 3ccd14d..d6e474c 100644
--- a/.bashrc
+++ b/.bashrc
@@ -10,6 +10,11 @@ safe_load() {
 	[ -r "$sh" ] && . "$sh"
 	unset sh
 }
+prepend_prompt_command() {
+	if [[ ${PROMPT_COMMAND:=} != *${1}* ]]; then
+		PROMPT_COMMAND="${1};${PROMPT_COMMAND#;}"
+	fi
+}
 
 # Test for an interactive shell.  There is no need to set anything
 # past this point for scp and rcp, and it's important to refrain from
@@ -29,10 +34,6 @@ shopt -s histappend
 #HISTFILESIZE=500000
 HISTCONTROL=ignorespace
 
-# set window title
-_set_win_title() {
-	printf '\033]0;%s\007' "${PWD} (${HOSTNAME}) - FOOT"
-}
 # OSC7 escapte sequence
 # https://codeberg.org/dnkl/foot/wiki#spawning-new-terminal-instances-in-the-current-working-directory
 _osc7_cwd() {
@@ -49,20 +50,20 @@ _osc7_cwd() {
 	done
 	printf '\e]7;file://%s%s\e\\' "${HOSTNAME}" "${encoded}"
 }
-# PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }_osc7_cwd
+prepend_prompt_command _osc7_cwd
+
 # OSC133 command prompt marker
 # https://codeberg.org/dnkl/foot/wiki#jumping-between-prompts
 _osc133_marker() {
 	printf '\e]133;A\e\\'
 }
-# PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }_osc133_marker
-# starship precmd
-_starship_precmd_user() {
-	_osc7_cwd
-	_osc133_marker
-	_set_win_title
+prepend_prompt_command _osc133_marker
+
+# set window title
+_set_win_title() {
+	printf '\033]0;%s\007' "${PWD} (${HOSTNAME}) - FOOT"
 }
-starship_precmd_user_func="_starship_precmd_user"
+prepend_prompt_command _set_win_title
 
 # Alias shell commands
 # alias logout='dbus-send --session --type=method_call --print-reply --dest='