From 0993e7ce88f90367b543d4bf324023a352304fe8 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 7 Jun 2015 03:08:24 +0200 Subject: [PATCH 1/3] New prompt segment `os_icon`. --- powerlevel9k.zsh-theme | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index df0319c7..699a8195 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -43,6 +43,16 @@ # POWERLEVEL9K_COLOR_SCHEME='light' ################################################################ +# 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. @@ -347,6 +357,19 @@ prompt_longstatus() { [[ -n "$symbols" ]] && $1_prompt_segment $0 $bg $DEFAULT_COLOR "$symbols" } +# print a little OS icon +prompt_os_icon() { + if [[ "$OS" == "Darwin" ]]; then + LOGO="\uF8FF" #  + elif [[ "$OS" == 'Linux' ]]; then + LOGO="\u1F427" # 🐧 + elif [[ "$OS" == 'FreeBSD' ]]; then + LOGO="\u1F608" # 😈 + fi + + $1_prompt_segment $0 008 241 $LOGO +} + # rbenv information prompt_rbenv() { if [[ -n "$RBENV_VERSION" ]]; then From 84dfa02a89157896392be8d226153c7c0630ebe2 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sat, 25 Jul 2015 00:02:32 +0200 Subject: [PATCH 2/3] Updated the os-icon prompt to newest coding guidelines. --- powerlevel9k.zsh-theme | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index d48b40b6..55fbb017 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -510,14 +510,14 @@ prompt_node_version() { # print a little OS icon prompt_os_icon() { if [[ "$OS" == "Darwin" ]]; then - LOGO="\uF8FF" #  + LOGO=$'\uF8FF' #  elif [[ "$OS" == 'Linux' ]]; then - LOGO="\u1F427" # 🐧 + LOGO=$'\u1F427' # 🐧 elif [[ "$OS" == 'FreeBSD' ]]; then - LOGO="\u1F608" # 😈 + LOGO=$'\u1F608' # 😈 fi - $1_prompt_segment $0 008 241 $LOGO + $1_prompt_segment "$0" "008" "241" "$LOGO" } # rbenv information From 2b00d09bfbae37641cc3d93d3f055eea273ca8c0 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sat, 25 Jul 2015 00:04:45 +0200 Subject: [PATCH 3/3] Added documentation. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 71dfceb2..662a6cc3 100644 --- a/README.md +++ b/README.md @@ -229,6 +229,7 @@ currently available are: * **dir** - Your current working directory. * **history** - The command number for the current line. * **node_version** - Show the version number of the installed Node.js. +* **os_icon** - Display a nice little icon, depending on your operating system. * **rbenv** - Ruby environment information (if one is active). * **rspec_stats** - Show a ratio of test classes vs code classes for RSpec. * **status** - The return code of the previous command, and status of background jobs.