mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-22 04:10:07 +00:00
os_icon: Combining OS detection and icon setting into one case statement
This commit is contained in:
parent
fb9dbe86f7
commit
4ef5294d0b
1 changed files with 10 additions and 18 deletions
|
@ -44,16 +44,6 @@
|
||||||
#zstyle ':vcs_info:*+*:*' debug true
|
#zstyle ':vcs_info:*+*:*' debug true
|
||||||
#set -o xtrace
|
#set -o xtrace
|
||||||
|
|
||||||
# OS detection, default to Linux
|
|
||||||
case $(uname) in
|
|
||||||
FreeBSD) OS=FreeBSD ;;
|
|
||||||
DragonFly) OS=FreeBSD ;;
|
|
||||||
OpenBSD) OS=OpenBSD ;;
|
|
||||||
Darwin) OS=Darwin ;;
|
|
||||||
SunOS) OS=SunOS ;;
|
|
||||||
*) OS=Linux ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# The `CURRENT_BG` variable is used to remember what the last BG color used was
|
# The `CURRENT_BG` variable is used to remember what the last BG color used was
|
||||||
# when building the left-hand prompt. Because the RPROMPT is created from
|
# when building the left-hand prompt. Because the RPROMPT is created from
|
||||||
# right-left but reads the opposite, this isn't necessary for the other side.
|
# right-left but reads the opposite, this isn't necessary for the other side.
|
||||||
|
@ -196,6 +186,15 @@ case $POWERLEVEL9K_MODE in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# OS detection for the `os_icon` segment
|
||||||
|
case $(uname) in
|
||||||
|
Darwin) OS_ICON=$APPLE_ICON ;;
|
||||||
|
FreeBSD) OS_ICON=$FREEBSD_ICON ;;
|
||||||
|
Linux) OS_ICON=$LINUX_ICON ;;
|
||||||
|
SunOS) OS_ICON=$SUNOS_ICON ;;
|
||||||
|
*) OS_ICON='' ;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [[ "$POWERLEVEL9K_HIDE_BRANCH_ICON" == true ]]; then
|
if [[ "$POWERLEVEL9K_HIDE_BRANCH_ICON" == true ]]; then
|
||||||
VCS_BRANCH_ICON=''
|
VCS_BRANCH_ICON=''
|
||||||
fi
|
fi
|
||||||
|
@ -525,14 +524,7 @@ prompt_node_version() {
|
||||||
|
|
||||||
# print a little OS icon
|
# print a little OS icon
|
||||||
prompt_os_icon() {
|
prompt_os_icon() {
|
||||||
case "$OS" in
|
$1_prompt_segment "$0" "008" "255" "$OS_ICON"
|
||||||
"Darwin") OS_ICON=$APPLE_ICON ;;
|
|
||||||
"FreeBSD") OS_ICON=$FREEBSD_ICON ;;
|
|
||||||
"Linux") OS_ICON=$LINUX_ICON ;;
|
|
||||||
"SunOS") OS_ICON=$SUNOS_ICON ;;
|
|
||||||
*) OS_ICON='' ;;
|
|
||||||
esac
|
|
||||||
$1_prompt_segment "$0" "008" "241" "$OS_ICON"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# rbenv information
|
# rbenv information
|
||||||
|
|
Loading…
Reference in a new issue