diff --git a/README.md b/README.md index 46d8ab61..2686b2e7 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,8 @@ The segments that are currently available are: * `rust_version` - Display the current rust version and [logo](https://www.rust-lang.org/logos/rust-logo-blk.svg). * **Swift Segments:** * `swift_version` - Show the version number of the installed Swift. +* **Java Segments:** + * `java_version` - Show the current Java version. **Cloud Segments:** * **AWS Segments:** diff --git a/functions/icons.zsh b/functions/icons.zsh index 7124386b..b7da9940 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -87,6 +87,7 @@ case $POWERLEVEL9K_MODE in SSH_ICON '(ssh)' VPN_ICON '(vpn)' KUBERNETES_ICON $'\U2388' # ⎈ + JAVA_ICON $'\U2615' # ☕︎ ) ;; 'awesome-fontconfig') @@ -158,6 +159,7 @@ case $POWERLEVEL9K_MODE in SSH_ICON '(ssh)' VPN_ICON $'\uF023' KUBERNETES_ICON $'\U2388' # ⎈ + JAVA_ICON $'\U2615' # ☕︎ ) ;; 'nerdfont-complete'|'nerdfont-fontconfig') @@ -229,6 +231,7 @@ case $POWERLEVEL9K_MODE in SSH_ICON $'\uF489' #  VPN_ICON '(vpn)' KUBERNETES_ICON $'\U2388' # ⎈ + JAVA_ICON $'\U2615' # ☕︎ ) ;; *) @@ -300,6 +303,7 @@ case $POWERLEVEL9K_MODE in SSH_ICON '(ssh)' VPN_ICON '(vpn)' KUBERNETES_ICON $'\U2388' # ⎈ + JAVA_ICON $'\U2615' # ☕︎ ) ;; esac diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 14d7bd81..e3be9c53 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1433,6 +1433,15 @@ prompt_kubecontext() { fi } +# print Java version number +prompt_java_version() { + local java_version + java_version=$(java -fullversion 2>&1 | cut -d '"' -f 2) + + if [[ -n "$java_version" ]]; then + "$1_prompt_segment" "$0" "$2" "red" "white" "$java_version" "JAVA_ICON" + fi +} ################################################################ # Prompt processing and drawing