add cog symbol to dir segment if folder is /etc*

This commit is contained in:
Tim Otlik 2018-05-17 12:08:04 +02:00
commit 557f5993ea
No known key found for this signature in database
GPG key ID: B453C855E9F039C5
2 changed files with 9 additions and 1 deletions

View file

@ -909,10 +909,13 @@ prompt_dir() {
"HOME" "HOME_ICON"
"HOME_SUBFOLDER" "HOME_SUB_ICON"
"NOT_WRITABLE" "LOCK_ICON"
"ETC" "ETC_ICON"
)
local state_path="$(print -P '%~')"
local current_state="DEFAULT"
if [[ "${POWERLEVEL9K_DIR_SHOW_WRITABLE}" == true && ! -w "$PWD" ]]; then
if [[ $state_path == '/etc'* ]]; then
current_state='ETC'
elif [[ "${POWERLEVEL9K_DIR_SHOW_WRITABLE}" == true && ! -w "$PWD" ]]; then
current_state="NOT_WRITABLE"
elif [[ $state_path == '~' ]]; then
current_state="HOME"