Add sub folder icon when in home subdirectories

Big thanks to @dritter for guidance, @rjorgenson for great explanation.
And @bhilburn for further guidance and encouragement.
See http://i.imgur.com/2Vncypo.png for a presentation of how it looks.
This commit is contained in:
Kayant 2016-01-15 23:12:38 +00:00
parent 94419f54a5
commit cf921fb90c
3 changed files with 8 additions and 2 deletions

View file

@ -210,11 +210,13 @@ others whole directories.
| `Compatible` | `Powerline` | `Awesome Powerline` | Situation
|------------|-----------|-------------------|----------------------------
| None | None | ![home icon](https://cloud.githubusercontent.com/assets/1544760/12183451/40ec4016-b58f-11e5-9b9e-74e2b2f0b8b3.png) | Within Home folder |
| None | None | ![home sub_icon](https://cloud.githubusercontent.com/assets/1544760/12369315/8a5d762c-bbf5-11e5-8a20-ca1179f48d6c.png) | Within Home sub folder |
| None | None | ![folder icon](https://cloud.githubusercontent.com/assets/1544760/12183452/40f79286-b58f-11e5-9b8c-ed1343a07b08.png) | Outside of home folder |
To turn off these icons you could set these variables to an empty string.
POWERLEVEL9K_HOME_ICON=''
POWERLEVEL9K_HOME_SUB_ICON=''
POWERLEVEL9K_FOLDER_ICON=''
##### ip

View file

@ -44,6 +44,7 @@ case $POWERLEVEL9K_MODE in
LINUX_ICON $'\UE271' # 
SUNOS_ICON $'\U1F31E ' # 🌞
HOME_ICON $'\UE12C' # 
HOME_SUB_ICON $'\UE18D' # 
FOLDER_ICON $'\UE818' # 
NETWORK_ICON $'\UE1AD' # 
LOAD_ICON $'\UE190 ' # 
@ -96,6 +97,7 @@ case $POWERLEVEL9K_MODE in
LINUX_ICON $'\UF17C' # 
SUNOS_ICON $'\UF185 ' # 
HOME_ICON $'\UF015' # 
HOME_SUB_ICON $'\UF07C' # 
FOLDER_ICON $'\UF115' # 
NETWORK_ICON $'\UF09E' # 
LOAD_ICON $'\UF080 ' # 
@ -143,6 +145,7 @@ case $POWERLEVEL9K_MODE in
LINUX_ICON 'Lx'
SUNOS_ICON 'Sun'
HOME_ICON ''
HOME_SUB_ICON ''
FOLDER_ICON ''
NETWORK_ICON 'IP'
LOAD_ICON 'L'
@ -202,4 +205,3 @@ get_icon_names() {
echo "POWERLEVEL9K_$key: ${icons[$key]}"
done
}

View file

@ -429,8 +429,10 @@ prompt_dir() {
fi
local current_icon=''
if [[ $(print -P "%~") == '~'* ]]; then
if [[ $(print -P "%~") == '~' ]]; then
"$1_prompt_segment" "$0_HOME" "$2" "blue" "$DEFAULT_COLOR" "$current_path" 'HOME_ICON'
elif [[ $(print -P "%~") == '~'* ]]; then
"$1_prompt_segment" "$0_HOME_SUBFOLDER" "$2" "blue" "$DEFAULT_COLOR" "$current_path" 'HOME_SUB_ICON'
else
"$1_prompt_segment" "$0_DEFAULT" "$2" "blue" "$DEFAULT_COLOR" "$current_path" 'FOLDER_ICON'
fi