TruncatedPwd_WindowTitle_Ubuntu.bgptheme 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ##############################################################################
  2. # Changes the prompt to a Debian-style one that truncates pwd to a max length
  3. # depending on the terminal column width. Also uses the prompt_callback
  4. # function of bash-git-prompt to set the window title to almost the same
  5. # Debian-style. This version has been tweaked for Ubuntu standard terminal
  6. # fonts.
  7. #
  8. # The prompt will use a Debian-style on the form
  9. #
  10. # [user@host: <truncated PWD>] [bash-git-prompt-info] <exit status>
  11. # HH:MM $
  12. #
  13. # The window title will have the form
  14. # user@host: <truncated PWD>
  15. #
  16. # Example usage:
  17. # if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then
  18. # GIT_PROMPT_THEME=TruncatedPwd_WindowTitle_Ubuntu
  19. # source ~/.bash-git-prompt/gitprompt.sh
  20. # fi
  21. #
  22. # oGre <oGre@muppfarmen.se> [https://github.com/ogr3]
  23. ##############################################################################
  24. override_git_prompt_colors() {
  25. GIT_PROMPT_THEME_NAME="TruncatedPwd_WindowTitle_Ubuntu"
  26. #Overrides the prompt_callback function used by bash-git-prompt
  27. function prompt_callback {
  28. local PS1="\u@\h: $(gp_truncate_pwd)"
  29. gp_set_window_title "${PS1}"
  30. echo -n "${Yellow}[${PS1}]${ResetColor}"
  31. }
  32. local gp_end=" _LAST_COMMAND_INDICATOR_\n${White}${Time12a}${ResetColor}"
  33. GIT_PROMPT_START_USER=""
  34. GIT_PROMPT_END_USER="${gp_end} $ "
  35. GIT_PROMPT_END_ROOT="${gp_end} # "
  36. GIT_PROMPT_STAGED="${Red}● " # the number of staged files/directories
  37. GIT_PROMPT_CLEAN="${BoldGreen}✔ " # a colored flag indicating a "clean" repo
  38. GIT_PROMPT_COMMAND_OK="${Green}✔ " # indicator if the last command returned with an exit code of 0
  39. }
  40. reload_git_prompt_colors "TruncatedPwd_WindowTitle_Ubuntu"