From be05aec8e143e14db824237be2aebeccd6b5957e Mon Sep 17 00:00:00 2001 From: Ariel Barreiro Date: Fri, 12 Apr 2024 13:29:23 -0300 Subject: [PATCH] Update window titles in bash/fish --- .ddev/addon-metadata/pimp-my-shell/manifest.yaml | 2 +- .ddev/homeadditions/.bashrc.d/pimp-my-shell.sh | 4 ++-- .ddev/homeadditions/.config/fish/conf.d/pimp-my-shell.fish | 6 +++++- homeadditions/.bashrc.d/pimp-my-shell.sh | 4 ++-- homeadditions/.config/fish/conf.d/pimp-my-shell.fish | 6 +++++- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.ddev/addon-metadata/pimp-my-shell/manifest.yaml b/.ddev/addon-metadata/pimp-my-shell/manifest.yaml index 2cda577..4cdd0a6 100644 --- a/.ddev/addon-metadata/pimp-my-shell/manifest.yaml +++ b/.ddev/addon-metadata/pimp-my-shell/manifest.yaml @@ -1,7 +1,7 @@ name: pimp-my-shell repository: . version: "" -install_date: "2024-04-12T12:12:39-03:00" +install_date: "2024-04-12T13:27:44-03:00" project_files: - web-build/Dockerfile.pimp-my-shell - homeadditions/.bashrc.d/pimp-my-shell.sh diff --git a/.ddev/homeadditions/.bashrc.d/pimp-my-shell.sh b/.ddev/homeadditions/.bashrc.d/pimp-my-shell.sh index ad3bace..6df337d 100644 --- a/.ddev/homeadditions/.bashrc.d/pimp-my-shell.sh +++ b/.ddev/homeadditions/.bashrc.d/pimp-my-shell.sh @@ -34,8 +34,8 @@ function set_win_title(){ # Shortening $PWD # /var/www/html -> /v/w/html local short_pwd=$(echo "$PWD" | sed 's/\([^\/]\)[^\/]*\//\1\//g') - echo -ne "\033]0; $DDEV_PROJECT ddev@$short_pwd - $@\007" + echo -ne "\033]0;$DDEV_PROJECT/ddev: $short_pwd $@\007" } starship_precmd_user_func="set_win_title" eval "$(starship init bash)" -trap "set_win_title \${BASH_COMMAND}" DEBUG +trap "set_win_title - \${BASH_COMMAND}" DEBUG diff --git a/.ddev/homeadditions/.config/fish/conf.d/pimp-my-shell.fish b/.ddev/homeadditions/.config/fish/conf.d/pimp-my-shell.fish index e8b0fb6..b56c5f6 100644 --- a/.ddev/homeadditions/.config/fish/conf.d/pimp-my-shell.fish +++ b/.ddev/homeadditions/.config/fish/conf.d/pimp-my-shell.fish @@ -19,5 +19,9 @@ if test -f /mnt/ddev-global-cache/fishhistory/$HOSTNAME/fish_history end function fish_title - echo "$DDEV_PROJECT ddev@"(fish_prompt_pwd_dir_length=1 prompt_pwd) - $argv + set --local title "$DDEV_PROJECT/ddev: "(fish_prompt_pwd_dir_length=1 prompt_pwd) + if count $argv > /dev/null + set title "$title - $argv" + end + echo $title end diff --git a/homeadditions/.bashrc.d/pimp-my-shell.sh b/homeadditions/.bashrc.d/pimp-my-shell.sh index ad3bace..6df337d 100644 --- a/homeadditions/.bashrc.d/pimp-my-shell.sh +++ b/homeadditions/.bashrc.d/pimp-my-shell.sh @@ -34,8 +34,8 @@ function set_win_title(){ # Shortening $PWD # /var/www/html -> /v/w/html local short_pwd=$(echo "$PWD" | sed 's/\([^\/]\)[^\/]*\//\1\//g') - echo -ne "\033]0; $DDEV_PROJECT ddev@$short_pwd - $@\007" + echo -ne "\033]0;$DDEV_PROJECT/ddev: $short_pwd $@\007" } starship_precmd_user_func="set_win_title" eval "$(starship init bash)" -trap "set_win_title \${BASH_COMMAND}" DEBUG +trap "set_win_title - \${BASH_COMMAND}" DEBUG diff --git a/homeadditions/.config/fish/conf.d/pimp-my-shell.fish b/homeadditions/.config/fish/conf.d/pimp-my-shell.fish index e8b0fb6..b56c5f6 100644 --- a/homeadditions/.config/fish/conf.d/pimp-my-shell.fish +++ b/homeadditions/.config/fish/conf.d/pimp-my-shell.fish @@ -19,5 +19,9 @@ if test -f /mnt/ddev-global-cache/fishhistory/$HOSTNAME/fish_history end function fish_title - echo "$DDEV_PROJECT ddev@"(fish_prompt_pwd_dir_length=1 prompt_pwd) - $argv + set --local title "$DDEV_PROJECT/ddev: "(fish_prompt_pwd_dir_length=1 prompt_pwd) + if count $argv > /dev/null + set title "$title - $argv" + end + echo $title end