From b567ab22c2889726974dcfed543cc9ecb7e190cb Mon Sep 17 00:00:00 2001 From: Richard Tippl Date: Tue, 8 Aug 2017 19:44:20 +0200 Subject: 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. --- powerlevel9k.zsh-theme | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'powerlevel9k.zsh-theme') diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index c2b53374..807495ec 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -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" -- cgit v1.2.3 From c4a1d91118abe95f4f5ce0580ffe58b452affefa Mon Sep 17 00:00:00 2001 From: Richard Tippl Date: Thu, 10 Aug 2017 17:49:42 +0200 Subject: Added a default value for DIR_SHOW_WRITABLE. Variable POWERLEVEL9K_DIR_SHOW_WRITABLE is now default set to false. --- powerlevel9k.zsh-theme | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'powerlevel9k.zsh-theme') diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 807495ec..8c78cb00 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -689,6 +689,7 @@ prompt_command_execution_time() { # Dir: current working directory set_default POWERLEVEL9K_DIR_PATH_SEPARATOR "/" set_default POWERLEVEL9K_HOME_FOLDER_ABBREVIATION "~" +set_default POWERLEVEL9K_DIR_SHOW_WRITABLE false prompt_dir() { local current_path="$(print -P "%~")" if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" || "$POWERLEVEL9K_SHORTEN_STRATEGY" == "truncate_with_folder_marker" ]]; then @@ -805,7 +806,7 @@ prompt_dir() { "NOT_WRITABLE" "LOCK_ICON" ) local current_state="DEFAULT" - if [[ "${POWERLEVEL9K_DIR_SHOW_WRITABLE}" == "true" && ! -w "$PWD" ]]; then + if [[ "${POWERLEVEL9K_DIR_SHOW_WRITABLE}" == true && ! -w "$PWD" ]]; then current_state="NOT_WRITABLE" elif [[ $(print -P "%~") == '~' ]]; then current_state="HOME" -- cgit v1.2.3