mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-14 09:00:07 +00:00
Merge branch 'next' of https://github.com/bhilburn/powerlevel9k into nerdfont
* 'next' of https://github.com/bhilburn/powerlevel9k: CHANGELOG: Updating to reflect work on `next` README: fixing name of `detect-virt` to `detect_virt` README: default segment list was no longer accurate updating changelog for segment name change `disk_usage` incorportaing feedback from review on `hdd_usage` segment Fix swift segment Updating the readme wih `hdd_usage` details. changing `hdd_usage` to actually show usage Moving `HDD_ICON` definition to consistent spot. Fix Fix Fix Fix Fix Fix Change colors Add anion155's HDD segment
This commit is contained in:
commit
60bb6ce0b3
4 changed files with 95 additions and 10 deletions
30
CHANGELOG.md
30
CHANGELOG.md
|
@ -1,11 +1,41 @@
|
||||||
## next
|
## next
|
||||||
|
|
||||||
|
- Fixed a bug where the tag display was broken on detached HEADs.
|
||||||
|
- Fixed a bug where SVN detection sometimes failed.
|
||||||
|
- Fixed the `load` and `ram` segments for BSD.
|
||||||
|
- Fixed code-points that changed in Awesome fonts.
|
||||||
|
- Fixed display of "OK_ICON" in `status` segment in non-verbose mode.
|
||||||
|
- Fixed an issue where dir name truncation that was very short sometimes failed.
|
||||||
|
- Speed & accuracy improvements to the battery segment.
|
||||||
|
- Added Github syntax highlighting to README.
|
||||||
|
- Various documentation cleanup.
|
||||||
|
|
||||||
|
### `vcs` changes
|
||||||
|
|
||||||
|
The VCS segment can now display icons for remote repo hosting services, including Github, Gitlab, and 'other'.
|
||||||
|
|
||||||
### `dir` changes
|
### `dir` changes
|
||||||
|
|
||||||
Added an option to configure the path separator. If you want something
|
Added an option to configure the path separator. If you want something
|
||||||
else than an ordinary slash, you could set
|
else than an ordinary slash, you could set
|
||||||
`POWERLEVEL9K_DIR_PATH_SEPARATOR` to whatever you want.
|
`POWERLEVEL9K_DIR_PATH_SEPARATOR` to whatever you want.
|
||||||
|
|
||||||
|
### New segment 'disk_usage' added
|
||||||
|
|
||||||
|
This segment will show the usage level of your current partition.
|
||||||
|
|
||||||
|
### New segment 'public_ip' added
|
||||||
|
|
||||||
|
Fetches your Public IP (using ident.me) and displays it in your prompt.
|
||||||
|
|
||||||
|
### New segment 'swift_version' added
|
||||||
|
|
||||||
|
This segment displays the version of Swift that is installed / in your path.
|
||||||
|
|
||||||
|
### New segment 'detect_virt' added
|
||||||
|
|
||||||
|
Detects and reports if you are in a virtualized session using `systemd`.
|
||||||
|
|
||||||
## v0.5.0
|
## v0.5.0
|
||||||
|
|
||||||
### `load` and `ram` changes
|
### `load` and `ram` changes
|
||||||
|
|
24
README.md
24
README.md
|
@ -46,8 +46,8 @@ Here is `powerlevel9k` in action, with [some simple settings](https://github.com
|
||||||
Be sure to also [check out the Wiki](https://github.com/bhilburn/powerlevel9k/wiki)!
|
Be sure to also [check out the Wiki](https://github.com/bhilburn/powerlevel9k/wiki)!
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
There are two installation steps to go from a lame terminal to a "Power Level
|
There are two installation steps to go from a vanilla terminal to a PL9k
|
||||||
9000" terminal. Once you are done, you can optionally customize your prompt.
|
terminal. Once you are done, you can optionally customize your prompt.
|
||||||
|
|
||||||
[Installation Instructions](https://github.com/bhilburn/powerlevel9k/wiki/Install-Instructions)
|
[Installation Instructions](https://github.com/bhilburn/powerlevel9k/wiki/Install-Instructions)
|
||||||
|
|
||||||
|
@ -71,14 +71,15 @@ variables to your `~/.zshrc`.
|
||||||
| Variable | Default Value | Description |
|
| Variable | Default Value | Description |
|
||||||
|----------|---------------|-------------|
|
|----------|---------------|-------------|
|
||||||
|`POWERLEVEL9K_LEFT_PROMPT_ELEMENTS`|`(context dir rbenv vcs)`|Segment list for left prompt|
|
|`POWERLEVEL9K_LEFT_PROMPT_ELEMENTS`|`(context dir rbenv vcs)`|Segment list for left prompt|
|
||||||
|`POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS`|`(status history time)`|Segment list for right prompt|
|
|`POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS`|`(status root_indicator background_jobs history time)`|Segment list for right prompt|
|
||||||
|
|
||||||
|
|
||||||
So if you wanted to set these variables manually, you would put the following in
|
The table above shows the default values, so if you wanted to set these
|
||||||
|
variables manually, you would put the following in
|
||||||
your `~/.zshrc`:
|
your `~/.zshrc`:
|
||||||
```zsh
|
```zsh
|
||||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs)
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs)
|
||||||
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status history time)
|
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time)
|
||||||
```
|
```
|
||||||
#### Available Prompt Segments
|
#### Available Prompt Segments
|
||||||
The segments that are currently available are:
|
The segments that are currently available are:
|
||||||
|
@ -88,6 +89,7 @@ The segments that are currently available are:
|
||||||
* [`battery`](#battery) - Current battery status.
|
* [`battery`](#battery) - Current battery status.
|
||||||
* [`context`](#context) - Your username and host.
|
* [`context`](#context) - Your username and host.
|
||||||
* [`dir`](#dir) - Your current working directory.
|
* [`dir`](#dir) - Your current working directory.
|
||||||
|
* [`disk_usage`](#disk_usage) - Disk usage of your current partition.
|
||||||
* `history` - The command number for the current line.
|
* `history` - The command number for the current line.
|
||||||
* [`ip`](#ip) - Shows the current IP address.
|
* [`ip`](#ip) - Shows the current IP address.
|
||||||
* [`public_ip`](#public_ip) - Shows your public IP address.
|
* [`public_ip`](#public_ip) - Shows your public IP address.
|
||||||
|
@ -137,7 +139,7 @@ The segments that are currently available are:
|
||||||
* [`custom_command`](#custom_command) - Create a custom segment to display the
|
* [`custom_command`](#custom_command) - Create a custom segment to display the
|
||||||
output of an arbitrary command.
|
output of an arbitrary command.
|
||||||
* [`todo`](http://todotxt.com/) - Shows the number of tasks in your todo.txt tasks file.
|
* [`todo`](http://todotxt.com/) - Shows the number of tasks in your todo.txt tasks file.
|
||||||
* `detect-virt` - Virtualization detection with systemd
|
* `detect_virt` - Virtualization detection with systemd
|
||||||
|
|
||||||
---------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -306,6 +308,16 @@ If you want to customize the directory separator, you could set:
|
||||||
POWERLEVEL9K_DIR_PATH_SEPARATOR="%f "$'\uE0B1'" %F"
|
POWERLEVEL9K_DIR_PATH_SEPARATOR="%f "$'\uE0B1'" %F"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### disk_usage
|
||||||
|
|
||||||
|
The `disk_usage` segment will show the usage level of the partition that your current working directory resides in. It can be configured with the following variables.
|
||||||
|
|
||||||
|
| Variable | Default Value | Description |
|
||||||
|
|----------|---------------|-------------|
|
||||||
|
|POWERLEVEL9K_DISK_USAGE_ONLY_WARNING|false|Hide the segment except when usage levels have hit warning or critical levels.|
|
||||||
|
|POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL|90|The usage level that triggers a warning state.|
|
||||||
|
|POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL|95|The usage level that triggers a critical state.|
|
||||||
|
|
||||||
##### ip
|
##### ip
|
||||||
|
|
||||||
This segment tries to examine all currently used network interfaces and prints
|
This segment tries to examine all currently used network interfaces and prints
|
||||||
|
|
|
@ -34,6 +34,7 @@ case $POWERLEVEL9K_MODE in
|
||||||
TEST_ICON $'\uE891' #
|
TEST_ICON $'\uE891' #
|
||||||
TODO_ICON $'\u2611' # ☑
|
TODO_ICON $'\u2611' # ☑
|
||||||
BATTERY_ICON $'\uE894' #
|
BATTERY_ICON $'\uE894' #
|
||||||
|
DISK_ICON $'\uE1AE ' #
|
||||||
OK_ICON $'\u2713' # ✓
|
OK_ICON $'\u2713' # ✓
|
||||||
FAIL_ICON $'\u2718' # ✘
|
FAIL_ICON $'\u2718' # ✘
|
||||||
SYMFONY_ICON 'SF'
|
SYMFONY_ICON 'SF'
|
||||||
|
@ -97,6 +98,7 @@ case $POWERLEVEL9K_MODE in
|
||||||
TEST_ICON $'\uF291' #
|
TEST_ICON $'\uF291' #
|
||||||
TODO_ICON $'\u2611' # ☑
|
TODO_ICON $'\u2611' # ☑
|
||||||
BATTERY_ICON $'\U1F50B' # 🔋
|
BATTERY_ICON $'\U1F50B' # 🔋
|
||||||
|
DISK_ICON $'\uF0A0 ' #
|
||||||
OK_ICON $'\u2713' # ✓
|
OK_ICON $'\u2713' # ✓
|
||||||
FAIL_ICON $'\u2718' # ✘
|
FAIL_ICON $'\u2718' # ✘
|
||||||
SYMFONY_ICON 'SF'
|
SYMFONY_ICON 'SF'
|
||||||
|
@ -212,6 +214,7 @@ case $POWERLEVEL9K_MODE in
|
||||||
TEST_ICON ''
|
TEST_ICON ''
|
||||||
TODO_ICON $'\u2611' # ☑
|
TODO_ICON $'\u2611' # ☑
|
||||||
BATTERY_ICON $'\U1F50B' # 🔋
|
BATTERY_ICON $'\U1F50B' # 🔋
|
||||||
|
DISK_ICON $'hdd '
|
||||||
OK_ICON $'\u2713' # ✓
|
OK_ICON $'\u2713' # ✓
|
||||||
FAIL_ICON $'\u2718' # ✘
|
FAIL_ICON $'\u2718' # ✘
|
||||||
SYMFONY_ICON 'SF'
|
SYMFONY_ICON 'SF'
|
||||||
|
|
|
@ -337,6 +337,48 @@ prompt_background_jobs() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Segment that indicates usage level of current partition.
|
||||||
|
set_default POWERLEVEL9K_DISK_USAGE_ONLY_WARNING false
|
||||||
|
set_default POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL 90
|
||||||
|
set_default POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL 95
|
||||||
|
prompt_disk_usage() {
|
||||||
|
local current_state="unknown"
|
||||||
|
typeset -AH hdd_usage_forecolors
|
||||||
|
hdd_usage_forecolors=(
|
||||||
|
'normal' 'yellow'
|
||||||
|
'warning' "$DEFAULT_COLOR"
|
||||||
|
'critical' 'white'
|
||||||
|
)
|
||||||
|
typeset -AH hdd_usage_backcolors
|
||||||
|
hdd_usage_backcolors=(
|
||||||
|
'normal' $DEFAULT_COLOR
|
||||||
|
'warning' 'yellow'
|
||||||
|
'critical' 'red'
|
||||||
|
)
|
||||||
|
|
||||||
|
local disk_usage="${$(\df -P . | sed -n '2p' | awk '{ print $5 }')%%\%}"
|
||||||
|
|
||||||
|
if [ "$disk_usage" -ge "$POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL" ]; then
|
||||||
|
current_state='warning'
|
||||||
|
if [ "$disk_usage" -ge "$POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL" ]; then
|
||||||
|
current_state='critical'
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ "$POWERLEVEL9K_DISK_USAGE_ONLY_WARNING" == true ]]; then
|
||||||
|
current_state=''
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
current_state='normal'
|
||||||
|
fi
|
||||||
|
|
||||||
|
local message="${disk_usage}%%"
|
||||||
|
|
||||||
|
# Draw the prompt_segment
|
||||||
|
if [[ -n $disk_usage ]]; then
|
||||||
|
"$1_prompt_segment" "${0}_${current_state}" "$2" "${hdd_usage_backcolors[$current_state]}" "${hdd_usage_forecolors[$current_state]}" "$message" 'DISK_ICON'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
prompt_battery() {
|
prompt_battery() {
|
||||||
# The battery can have four different states - default to 'unknown'.
|
# The battery can have four different states - default to 'unknown'.
|
||||||
local current_state='unknown'
|
local current_state='unknown'
|
||||||
|
@ -1065,12 +1107,10 @@ prompt_pyenv() {
|
||||||
|
|
||||||
# Swift version
|
# Swift version
|
||||||
prompt_swift_version() {
|
prompt_swift_version() {
|
||||||
local swift_version=($(swift --version 2>/dev/null))
|
# Get the first number as this is probably the "main" version number..
|
||||||
|
local swift_version=$(swift --version 2>/dev/null | grep -o -E "[0-9.]+" | head -n 1)
|
||||||
[[ -z "${swift_version}" ]] && return
|
[[ -z "${swift_version}" ]] && return
|
||||||
|
|
||||||
# Extract semantic version
|
|
||||||
swift_version=$(echo ${swift_version} | sed -e 's/[^0-9.]*\([0-9.]*\).*/\1/')
|
|
||||||
|
|
||||||
"$1_prompt_segment" "$0" "$2" "magenta" "white" "${swift_version}" 'SWIFT_ICON'
|
"$1_prompt_segment" "$0" "$2" "magenta" "white" "${swift_version}" 'SWIFT_ICON'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue