diff options
-rw-r--r-- | CHANGELOG.md | 20 | ||||
-rw-r--r-- | README.md | 15 | ||||
-rw-r--r-- | functions/icons.zsh | 74 | ||||
-rwxr-xr-x | powerlevel9k.zsh-theme | 23 |
4 files changed, 118 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 42120aea..0a8842a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,24 @@ -## Next +## v0.6.4 +- `load` segment now has configurable averages. +- Update to `dir` segment to add `dir_writable` feature. +- `status` segment can now display POSIX signal name of exit code. - Added `teardown` command to turn off P9k prompt. - Fixes for P9k in Cygwin and 32-bit systems. - Better colors in virtualization segments. - Added 'Gopher' icon to the `go_version` segment. - Improved detection in `nvm` - Added option to support command status reading from piped command sequences. +- Fixed issue with visual artifacts with quick consecutive commands. +- Updated 'ananconda' segment for more uniform styling. +- `rvm` segment can now support usernames with dashes. +- Fixed Python icon reference in some font configurations. +- Vi mode indicator fixed. +- Fixes for Docker segment. +- Added new Docker-based testing system. +- Significant enhancements to the `battery` segment. Check out the README to + read more! +- New truncation strategy that truncates until the path becomes unique. ### New Segments: `host` and `user` @@ -24,11 +37,6 @@ Shows the current context of your `kubectl` configuration. Shows current `vpn` interface. -## v0.6.4 - -- Significant enhancements to the `battery` segment. Check out the README to - read more! - ## v0.6.3 - Fixed susceptibility to [pw3nage exploit](https://github.com/njhartwell/pw3nage). @@ -96,7 +96,7 @@ The segments that are currently available are: * [`ip`](#ip) - Shows the current IP address. * [`vpn`](#vpn) - Shows the current VPN IP address. * [`public_ip`](#public_ip) - Shows your public IP address. -* `load` - Your machine's load averages. +* [`load`](#load) - Your machine's load averages. * `os_icon` - Display a nice little icon, depending on your operating system. * `ram` - Show free RAM. * `root_indicator` - An indicator if the user has superuser status. @@ -321,7 +321,7 @@ POWERLEVEL9K_CONTEXT_TEMPLATE="%n@`hostname -f`" ``` You can set the `POWERLEVEL9K_CONTEXT_HOST_DEPTH` variable to change how the -hostname is displayed. See (ZSH Manual)[http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Login-information] +hostname is displayed. See [ZSH Manual](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Login-information) for details. The default is set to %m which will show the hostname up to the first ‘.’ You can set it to %{N}m where N is an integer to show that many segments of system hostname. Setting N to a negative integer will show that many segments from the @@ -482,6 +482,17 @@ segment will not be displayed. |`POWERLEVEL9K_PUBLIC_IP_METHODS`|(dig curl wget)| These methods in that order are used to refresh your IP.| |`POWERLEVEL9K_PUBLIC_IP_NONE`|None|The string displayed when an IP was not obtained| +##### load + +Displays one of your load averages with appropriate state coloring. The thresholds are: +- `0.7 * NUM_CORES <`: critical +- `0.5 * NUM_CORES <`: warning +- `less`: normal + +| Variable | Default Value | Description | +|----------|---------------|-------------| +|`POWERLEVEL9K_LOAD_WHICH`|5|Which average to show. Possible values: 1, 5 or 15| + ##### newline Puts a newline in your prompt so you can continue using segments on the next diff --git a/functions/icons.zsh b/functions/icons.zsh index 3a4909f7..a20cef2c 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -160,6 +160,80 @@ case $POWERLEVEL9K_MODE in KUBERNETES_ICON $'\U2388' # ⎈ ) ;; + 'awesome-mapped-fontconfig') + # mapped fontconfig with awesome-font required! See + # https://github.com/gabrielelana/awesome-terminal-fonts + # don't forget to source the font maps in your startup script + # Set the right locale to protect special characters + local LC_ALL="" LC_CTYPE="en_US.UTF-8" + + if [ -z "$AWESOME_GLYPHS_LOADED" ]; then + echo "Powerlevel9k warning: Awesome-Font mappings have not been loaded. + Source a font mapping in your shell config, per the Awesome-Font docs + (https://github.com/gabrielelana/awesome-terminal-fonts), + Or use a different Powerlevel9k font configuration."; + fi + + icons=( + LEFT_SEGMENT_SEPARATOR $'\uE0B0' # + RIGHT_SEGMENT_SEPARATOR $'\uE0B2' # + LEFT_SEGMENT_END_SEPARATOR ' ' # Whitespace + LEFT_SUBSEGMENT_SEPARATOR $'\uE0B1' # + RIGHT_SUBSEGMENT_SEPARATOR $'\uE0B3' # + CARRIAGE_RETURN_ICON $'\u21B5' # ↵ + ROOT_ICON '\u'$CODEPOINT_OF_OCTICONS_ZAP # + RUBY_ICON '\u'$CODEPOINT_OF_OCTICONS_RUBY' ' # + AWS_ICON '\u'$CODEPOINT_OF_AWESOME_SERVER # + AWS_EB_ICON $'\U1F331 ' # 🌱 + BACKGROUND_JOBS_ICON '\u'$CODEPOINT_OF_AWESOME_COG' ' # + TEST_ICON '\u'$CODEPOINT_OF_AWESOME_BUG # + TODO_ICON '\u'$CODEPOINT_OF_AWESOME_CHECK_SQUARE_O # + BATTERY_ICON '\U'$CODEPOINT_OF_AWESOME_BATTERY_FULL # + DISK_ICON '\u'$CODEPOINT_OF_AWESOME_HDD_O' ' # + OK_ICON '\u'$CODEPOINT_OF_AWESOME_CHECK # + FAIL_ICON '\u'$CODEPOINT_OF_AWESOME_TIMES # + SYMFONY_ICON 'SF' + NODE_ICON $'\u2B22' # ⬢ + MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─ + MULTILINE_SECOND_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─ + APPLE_ICON '\u'$CODEPOINT_OF_AWESOME_APPLE # + FREEBSD_ICON $'\U1F608 ' # 😈 + LINUX_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # + SUNOS_ICON '\u'$CODEPOINT_OF_AWESOME_SUN_O' ' # + HOME_ICON '\u'$CODEPOINT_OF_AWESOME_HOME # + HOME_SUB_ICON '\u'$CODEPOINT_OF_AWESOME_FOLDER_OPEN # + FOLDER_ICON '\u'$CODEPOINT_OF_AWESOME_FOLDER_O # + NETWORK_ICON '\u'$CODEPOINT_OF_AWESOME_RSS # + LOAD_ICON '\u'$CODEPOINT_OF_AWESOME_BAR_CHART' ' # + SWAP_ICON '\u'$CODEPOINT_OF_AWESOME_DASHBOARD # + RAM_ICON '\u'$CODEPOINT_OF_AWESOME_DASHBOARD # + SERVER_ICON '\u'$CODEPOINT_OF_AWESOME_SERVER # + VCS_UNTRACKED_ICON '\u'$CODEPOINT_OF_AWESOME_QUESTION_CIRCLE # + VCS_UNSTAGED_ICON '\u'$CODEPOINT_OF_AWESOME_EXCLAMATION_CIRCLE # + VCS_STAGED_ICON '\u'$CODEPOINT_OF_AWESOME_PLUS_CIRCLE # + VCS_STASH_ICON '\u'$CODEPOINT_OF_AWESOME_INBOX' ' # + VCS_INCOMING_CHANGES_ICON '\u'$CODEPOINT_OF_AWESOME_ARROW_CIRCLE_DOWN' ' # + VCS_OUTGOING_CHANGES_ICON '\u'$CODEPOINT_OF_AWESOME_ARROW_CIRCLE_UP' ' # + VCS_TAG_ICON '\u'$CODEPOINT_OF_AWESOME_TAG' ' # + VCS_BOOKMARK_ICON '\u'$CODEPOINT_OF_OCTICONS_BOOKMARK # + VCS_COMMIT_ICON '\u'$CODEPOINT_OF_OCTICONS_GIT_COMMIT' ' # + VCS_BRANCH_ICON '\u'$CODEPOINT_OF_OCTICONS_GIT_BRANCH' ' # + VCS_REMOTE_BRANCH_ICON '\u'$CODEPOINT_OF_OCTICONS_REPO_PUSH # + VCS_GIT_ICON '\u'$CODEPOINT_OF_AWESOME_GIT' ' # + VCS_GIT_GITHUB_ICON '\u'$CODEPOINT_OF_AWESOME_GITHUB_ALT' ' # + VCS_GIT_BITBUCKET_ICON '\u'$CODEPOINT_OF_AWESOME_BITBUCKET' ' # + VCS_GIT_GITLAB_ICON '\u'$CODEPOINT_OF_AWESOME_GITLAB' ' # + VCS_HG_ICON '\u'$CODEPOINT_OF_AWESOME_FLASK' ' # + VCS_SVN_ICON '(svn) ' + RUST_ICON $'\uE6A8' # + PYTHON_ICON $'\U1F40D' # 🐍 + SWIFT_ICON $'\uE655' # + PUBLIC_IP_ICON '\u'$CODEPOINT_OF_AWESOME_GLOBE # + LOCK_ICON '\u'$CODEPOINT_OF_AWESOME_LOCK # + EXECUTION_TIME_ICON '\u'$CODEPOINT_OF_AWESOME_HOURGLASS_END # + SSH_ICON '(ssh)' + ) + ;; 'nerdfont-complete'|'nerdfont-fontconfig') # nerd-font patched (complete) font required! See # https://github.com/ryanoasis/nerd-fonts diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index d7d99c3f..148ffeab 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -937,6 +937,8 @@ prompt_load() { local current_state="unknown" local cores + set_default POWERLEVEL9K_LOAD_WHICH 5 + typeset -AH load_states load_states=( 'critical' 'red' @@ -945,31 +947,40 @@ prompt_load() { ) if [[ "$OS" == "OSX" ]] || [[ "$OS" == "BSD" ]]; then - load_avg_1min=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 1) + + if [[ "$POWERLEVEL9K_LOAD_WHICH" -eq 1 ]]; then + load_avg=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 3 | sed -n 1p) + elif [[ "$POWERLEVEL9K_LOAD_WHICH" -eq 5 ]]; then + load_avg=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 3 | sed -n 2p) + else + load_avg=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 3 | sed -n 3p) + fi + if [[ "$OS" == "OSX" ]]; then cores=$(sysctl -n hw.logicalcpu) else cores=$(sysctl -n hw.ncpu) fi else - load_avg_1min=$(grep -o "[0-9.]*" /proc/loadavg | head -n 1) + load_avg=$(grep -o "[0-9.]*" /proc/loadavg | head -n 1) cores=$(nproc) fi # Replace comma - load_avg_1min=${load_avg_1min//,/.} + load_avg=${load_avg//,/.} - if [[ "$load_avg_1min" -gt $(bc -l <<< "${cores} * 0.7") ]]; then + if [[ "$load_avg" -gt $(bc -l <<< "${cores} * 0.7") ]]; then current_state="critical" - elif [[ "$load_avg_1min" -gt $(bc -l <<< "${cores} * 0.5") ]]; then +elif [[ "$load_avg" -gt $(bc -l <<< "${cores} * 0.5") ]]; then current_state="warning" else current_state="normal" fi - "$1_prompt_segment" "${0}_${current_state}" "$2" "${load_states[$current_state]}" "$DEFAULT_COLOR" "$load_avg_1min" 'LOAD_ICON' + "$1_prompt_segment" "${0}_${current_state}" "$2" "${load_states[$current_state]}" "$DEFAULT_COLOR" "$load_avg" 'LOAD_ICON' } + # Node version prompt_node_version() { local node_version=$(node -v 2>/dev/null) |