diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2015-07-27 00:18:02 +0300 |
---|---|---|
committer | Ben Hilburn <bhilburn@gmail.com> | 2015-07-27 00:18:02 +0300 |
commit | 0395709fa01a38da626a2b9dc3ba53535cdfdae6 (patch) | |
tree | 4b28f9d2b07ebb14d5efeca0676982b1c751f895 | |
parent | 925e6752f7261efb031c333e6c1206093760a321 (diff) | |
parent | 2b00d09bfbae37641cc3d93d3f055eea273ca8c0 (diff) |
Merge remote-tracking branch 'dritter/dritter/os_detection' into staging
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | powerlevel9k.zsh-theme | 28 |
2 files changed, 29 insertions, 0 deletions
@@ -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. diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 69eee6e3..55fbb017 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -44,6 +44,21 @@ #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. +CURRENT_BG='NONE' + # These characters require the Powerline fonts to work properly. If see boxes or # bizarre characters below, your fonts are not correctly installed. If you # do not want to install a special font, you can set `POWERLEVEL9K_MODE` to @@ -492,6 +507,19 @@ prompt_node_version() { $1_prompt_segment "$0" "green" "white" "${nvm_prompt:1} $NODE_ICON" } +# 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 |