logo

dotfiles

My dotfiles, one branch per machine, rebased on base git clone https://anongit.hacktivis.me/git/dotfiles.git/
commit: a3b049c7d6a8090d648c5164353ff43d28572183
parent 129cef3b1eb60eab2a56e81b4fd7c5da0e32498b
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri,  6 Jun 2025 10:46:23 +0200

.common.sh: Add precmd (foot) and osc_title (xterm-like)

Diffstat:

M.common.sh16++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/.common.sh b/.common.sh @@ -84,15 +84,25 @@ jobs_pp() { fi } +precmd() { + # https://codeberg.org/dnkl/foot#jumping-between-prompts + # \e →  + printf ']133;A\\' +} + +osc_title() { + printf ']0;%s\\' "$*" +} + # Note: PS1/…/PS4 variables are shell specific and therefore shouldn't be exported PS4='$ ' case $SHELL in *ksh*) # hack derived from ksh88(1), works in mksh, doesn't works in bash - PS1='$(jobs_pp)$?$(date +w%wT%T)${USER}[${host_ansi}m@$(hostname)$(get_working_directory)$(get_git_branch) ' + PS1='$(jobs_pp)$?$(date +w%wT%T)${USER}[${host_ansi}m@$(hostname)$(get_working_directory)$(get_git_branch)$(precmd) ' ;; *bash*) - PS1='\[\e[47;30m\]$(jobs_pp)$?\[\e[37;100m\]\[\e[100;30m\]$(date +w%wT%T)\[\e[40;90m\]\[\e[40;32m\]\u\[\e[${host_ansi}m\]@\h\]\[\e[30;46m\]$(get_working_directory)\[\e[0;36m\]\[\e[0m\] ' + PS1='\[\e[47;30m\]$(jobs_pp)$?\[\e[37;100m\]\[\e[100;30m\]$(date +w%wT%T)\[\e[40;90m\]\[\e[40;32m\]\u\[\e[${host_ansi}m\]@\h\]\[\e[30;46m\]$(get_working_directory)\[\e[0;36m\]\[\e[0m$(precmd)\] ' ;; *) # Don't even try escape codes, and so no powerline-style @@ -257,4 +267,6 @@ fi stty -ixon # Disable stop (^S) / start (^Q) stty -ixoff # Disable sending of start/stop characters +osc_title "$LOGNAME@$(hostname):$(tty)" + h