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.
pull/22/head
Richard Tippl 7 years ago
parent 93a1c4d2e8
commit b567ab22c2

@ -802,9 +802,12 @@ prompt_dir() {
"DEFAULT" "FOLDER_ICON" "DEFAULT" "FOLDER_ICON"
"HOME" "HOME_ICON" "HOME" "HOME_ICON"
"HOME_SUBFOLDER" "HOME_SUB_ICON" "HOME_SUBFOLDER" "HOME_SUB_ICON"
"NOT_WRITABLE" "LOCK_ICON"
) )
local current_state="DEFAULT" 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" current_state="HOME"
elif [[ $(print -P "%~") == '~'* ]]; then elif [[ $(print -P "%~") == '~'* ]]; then
current_state="HOME_SUBFOLDER" current_state="HOME_SUBFOLDER"

Loading…
Cancel
Save