summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2015-07-29 05:56:46 +0300
committerBen Hilburn <bhilburn@gmail.com>2015-07-29 05:56:46 +0300
commit4ef5294d0b082e46526c2290187b0ee8667e4f4c (patch)
treefce5685e27fc5eb978f21017de5a317338ccc554
parentfb9dbe86f7ba2398e726aa37fe6705798f4eb609 (diff)
os_icon: Combining OS detection and icon setting into one case statement
-rw-r--r--powerlevel9k.zsh-theme28
1 files changed, 10 insertions, 18 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 9962744f..8e442328 100644
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -44,16 +44,6 @@
#zstyle ':vcs_info:*+*:*' debug true
#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
# 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.
@@ -196,6 +186,15 @@ case $POWERLEVEL9K_MODE in
;;
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
VCS_BRANCH_ICON=''
fi
@@ -525,14 +524,7 @@ prompt_node_version() {
# print a little OS icon
prompt_os_icon() {
- case "$OS" in
- "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"
+ $1_prompt_segment "$0" "008" "255" "$OS_ICON"
}
# rbenv information