Skip to content

Commit

Permalink
Update window titles in bash/fish
Browse files Browse the repository at this point in the history
  • Loading branch information
hanoii committed Apr 12, 2024
1 parent f6bd8b0 commit be05aec
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .ddev/addon-metadata/pimp-my-shell/manifest.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions .ddev/homeadditions/.bashrc.d/pimp-my-shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion .ddev/homeadditions/.config/fish/conf.d/pimp-my-shell.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions homeadditions/.bashrc.d/pimp-my-shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion homeadditions/.config/fish/conf.d/pimp-my-shell.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit be05aec

Please sign in to comment.