Implemented functionality from dir_writable to dir

When variable POWERLEVEL9K_DIR_SHOW_WRITABLE is set to true, dir prompt
will have new state NOT_WRITABLE.

This state will be set when user doesn't have permission to write in
current working directory as in prompt dir_writable.

When mode that allows icons is set, LOCK_ICON is used.
This commit is contained in:
Richard Tippl 2017-08-08 19:44:20 +02:00
parent 93a1c4d2e8
commit b567ab22c2

View file

@ -802,9 +802,12 @@ prompt_dir() {
"DEFAULT" "FOLDER_ICON"
"HOME" "HOME_ICON"
"HOME_SUBFOLDER" "HOME_SUB_ICON"
"NOT_WRITABLE" "LOCK_ICON"
)
local current_state="DEFAULT"
if [[ $(print -P "%~") == '~' ]]; then
if [[ "${POWERLEVEL9K_DIR_SHOW_WRITABLE}" == "true" && ! -w "$PWD" ]]; then
current_state="NOT_WRITABLE"
elif [[ $(print -P "%~") == '~' ]]; then
current_state="HOME"
elif [[ $(print -P "%~") == '~'* ]]; then
current_state="HOME_SUBFOLDER"