Compare commits

..

3 Commits

Author SHA1 Message Date
Roman Perepelitsa c8dc91ad58 wip 5 months ago
Roman Perepelitsa f1b204ea4d Merge branch 'Freed-Wu-wifi' 5 months ago
Wu, Zhenyu cfd507a501
support wifi for Android 5 months ago

@ -2,11 +2,6 @@
[![Gitter](https://badges.gitter.im/powerlevel10k/community.svg)](
https://gitter.im/powerlevel10k/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
- **THE PROJECT HAS VERY LIMITED SUPPORT**
- **NO NEW FEATURES ARE IN THE WORKS**
- **MOST BUGS WILL GO UNFIXED**
- **HELP REQUESTS WILL BE IGNORED**
Powerlevel10k is a theme for Zsh. It emphasizes [speed](#uncompromising-performance),
[flexibility](#extremely-customizable) and [out-of-the-box experience](#configuration-wizard).
@ -675,7 +670,6 @@ If you are using a different terminal, proceed with manual font installation.
- **Windows Terminal** by Microsoft (the new thing): Open *Settings* (<kbd>Ctrl+,</kbd>), click
either on the selected profile under *Profiles* or on *Defaults*, click *Appearance* and set
*Font face* to `MesloLGS NF`.
- **Conemu**: Open *Setup → General → Fonts* and set *Main console font* to `MesloLGS NF`.
- **IntelliJ** (and other IDEs by Jet Brains): Open *IDE → Edit → Preferences → Editor →
Color Scheme → Console Font*. Select *Use console font instead of the default* and set the font
name to `MesloLGS NF`.
@ -1348,12 +1342,6 @@ typeset -g POWERLEVEL9K_TIME_FOREGROUND='#FF0000'
*Related:*
- [Directory is difficult to see in prompt when using Rainbow style.](
#directory-is-difficult-to-see-in-prompt-when-using-rainbow-style)
- [Incorrect foreground color in VSCode Terminal.](#incorrect-foreground-color-in-vscode-terminal)
By default, VSCode Terminal may arbitrarily replace the foreground color of your choice with a
different color. This behavior can be
[turned off](https://code.visualstudio.com/docs/terminal/appearance#_minimum-contrast-ratio) in
VSCode settings.
### Why does Powerlevel10k spawn extra processes?
@ -1543,7 +1531,6 @@ Powerlevel10k are released. This may change in the future but not soon.
- [Transient prompt stops working after some time](#transient-prompt-stops-working-after-some-time)
- [Cannot make Powerlevel10k work with my plugin manager](#cannot-make-powerlevel10k-work-with-my-plugin-manager)
- [Directory is difficult to see in prompt when using Rainbow style](#directory-is-difficult-to-see-in-prompt-when-using-rainbow-style)
- [Incorrect foreground color in VSCode Terminal.](#incorrect-foreground-color-in-vscode-terminal)
- [Horrific mess when resizing terminal window](#horrific-mess-when-resizing-terminal-window)
- [Icons cut off in Konsole](#icons-cut-off-in-konsole)
- [Arch Linux logo has a dot in the bottom right corner](#arch-linux-logo-has-a-dot-in-the-bottom-right-corner)
@ -1887,15 +1874,6 @@ There are several ways to fix this.
`POWERLEVEL9K_DIR_ANCHOR_FOREGROUND` and `POWERLEVEL9K_DIR_ANCHOR_BOLD`. You can find them in
`~/.p10k.zsh`.
*Related*: [Incorrect foreground color in VSCode Terminal.](#incorrect-foreground-color-in-vscode-terminal)
### Incorrect foreground color in VSCode Terminal
By default, VSCode Terminal may arbitrarily replace the foreground color of your choice with a
different color. This behavior can be
[turned off](https://code.visualstudio.com/docs/terminal/appearance#_minimum-contrast-ratio) in
VSCode settings.
### Horrific mess when resizing terminal window
When you resize a terminal window horizontally back and forth a few times, you might see this ugly

@ -1677,7 +1677,7 @@
# User-defined prompt segments may optionally provide an instant_prompt_* function. Its job
# is to generate the prompt segment for display in instant prompt. See
# https://github.com/romkatv/powerlevel10k#instant-prompt.
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
#
# Powerlevel10k will call instant_prompt_* at the same time as the regular prompt_* function
# and will record all `p10k segment` calls it makes. When displaying instant prompt, Powerlevel10k
@ -1713,7 +1713,7 @@
# it incompatible with your zsh configuration files.
# - quiet: Enable instant prompt and don't print warnings when detecting console output
# during zsh initialization. Choose this if you've read and understood
# https://github.com/romkatv/powerlevel10k#instant-prompt.
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
# - verbose: Enable instant prompt and print a warning when detecting console output during
# zsh initialization. Choose this if you've never tried instant prompt, haven't
# seen the warning, or if you are unsure what this all means.

@ -1652,7 +1652,7 @@
# User-defined prompt segments may optionally provide an instant_prompt_* function. Its job
# is to generate the prompt segment for display in instant prompt. See
# https://github.com/romkatv/powerlevel10k#instant-prompt.
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
#
# Powerlevel10k will call instant_prompt_* at the same time as the regular prompt_* function
# and will record all `p10k segment` calls it makes. When displaying instant prompt, Powerlevel10k
@ -1688,7 +1688,7 @@
# it incompatible with your zsh configuration files.
# - quiet: Enable instant prompt and don't print warnings when detecting console output
# during zsh initialization. Choose this if you've read and understood
# https://github.com/romkatv/powerlevel10k#instant-prompt.
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
# - verbose: Enable instant prompt and print a warning when detecting console output during
# zsh initialization. Choose this if you've never tried instant prompt, haven't
# seen the warning, or if you are unsure what this all means.

@ -1652,7 +1652,7 @@
# User-defined prompt segments may optionally provide an instant_prompt_* function. Its job
# is to generate the prompt segment for display in instant prompt. See
# https://github.com/romkatv/powerlevel10k#instant-prompt.
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
#
# Powerlevel10k will call instant_prompt_* at the same time as the regular prompt_* function
# and will record all `p10k segment` calls it makes. When displaying instant prompt, Powerlevel10k
@ -1688,7 +1688,7 @@
# it incompatible with your zsh configuration files.
# - quiet: Enable instant prompt and don't print warnings when detecting console output
# during zsh initialization. Choose this if you've read and understood
# https://github.com/romkatv/powerlevel10k#instant-prompt.
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
# - verbose: Enable instant prompt and print a warning when detecting console output during
# zsh initialization. Choose this if you've never tried instant prompt, haven't
# seen the warning, or if you are unsure what this all means.

@ -169,7 +169,7 @@
# it incompatible with your zsh configuration files.
# - quiet: Enable instant prompt and don't print warnings when detecting console output
# during zsh initialization. Choose this if you've read and understood
# https://github.com/romkatv/powerlevel10k#instant-prompt.
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
# - verbose: Enable instant prompt and print a warning when detecting console output during
# zsh initialization. Choose this if you've never tried instant prompt, haven't
# seen the warning, or if you are unsure what this all means.

@ -1774,7 +1774,7 @@
# User-defined prompt segments may optionally provide an instant_prompt_* function. Its job
# is to generate the prompt segment for display in instant prompt. See
# https://github.com/romkatv/powerlevel10k#instant-prompt.
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
#
# Powerlevel10k will call instant_prompt_* at the same time as the regular prompt_* function
# and will record all `p10k segment` calls it makes. When displaying instant prompt, Powerlevel10k
@ -1811,7 +1811,7 @@
# it incompatible with your zsh configuration files.
# - quiet: Enable instant prompt and don't print warnings when detecting console output
# during zsh initialization. Choose this if you've read and understood
# https://github.com/romkatv/powerlevel10k#instant-prompt.
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
# - verbose: Enable instant prompt and print a warning when detecting console output during
# zsh initialization. Choose this if you've never tried instant prompt, haven't
# seen the warning, or if you are unsure what this all means.

@ -87,7 +87,7 @@
# it incompatible with your zsh configuration files.
# - quiet: Enable instant prompt and don't print warnings when detecting console output
# during zsh initialization. Choose this if you've read and understood
# https://github.com/romkatv/powerlevel10k#instant-prompt.
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
# - verbose: Enable instant prompt and print a warning when detecting console output during
# zsh initialization. Choose this if you've never tried instant prompt, haven't
# seen the warning, or if you are unsure what this all means.

@ -55,7 +55,6 @@ If you are using a different terminal, proceed with manual font installation.
- **Windows Terminal** by Microsoft (the new thing): Open *Settings* (<kbd>Ctrl+,</kbd>), click
either on the selected profile under *Profiles* or on *Defaults*, click *Appearance* and set
*Font face* to `MesloLGS NF`.
- **Conemu**: Open *Setup → General → Fonts* and set *Main console font* to `MesloLGS NF`.
- **IntelliJ** (and other IDEs by Jet Brains): Open *IDE → Edit → Preferences → Editor →
Color Scheme → Console Font*. Select *Use console font instead of the default* and set the font
name to `MesloLGS NF`.

@ -5125,7 +5125,7 @@ function _p9k_timewarrior_clear() {
function prompt_timewarrior() {
local dir
[[ -n ${dir::=$TIMEWARRIORDB} || -n ${dir::=~/.timewarrior}(#q-/N) ]] ||
[[ -n ${dir::=$TIMEWARRIORDB} || -n ${dir::=~/.timewarrior}(#qN/) ]] ||
dir=${XDG_DATA_HOME:-~/.local/share}/timewarrior
dir+=/data
local -a stat
@ -5264,9 +5264,7 @@ function _p9k_taskwarrior_init_data() {
local -a ts
ts=($(command task +PENDING -OVERDUE list rc.verbose=nothing rc.color=0 rc._forcecolor=0 \
rc.report.list.labels= rc.report.list.columns=due.epoch </dev/null 2>/dev/null)) || ts=()
# The second condition is a workaround for a bug in taskwarrior v3.0.1.
# https://github.com/romkatv/powerlevel10k/issues/2648.
if (( $#ts && ! ${#${(@)ts:#(|-)<->(|.<->)}} )); then
if (( $#ts )); then
_p9k_taskwarrior_next_due=${${(on)ts}[1]}
(( _p9k_taskwarrior_next_due > EPOCHSECONDS )) || _p9k_taskwarrior_next_due=$((EPOCHSECONDS+60))
fi
@ -5314,7 +5312,8 @@ prompt_wifi() {
_p9k_prompt_wifi_init() {
if [[ -x /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport ||
-r /proc/net/wireless && -n $commands[iw] ]]; then
-r /proc/net/wireless && -n $commands[iw] ]] ||
(( _POWERLEVEL9K_USE_DANGEROUS_TERMUX_API && $+commands[termux-wifi-connectioninfo] )); then
typeset -g _p9k__wifi_on=
typeset -g P9K_WIFI_LAST_TX_RATE=
typeset -g P9K_WIFI_SSID=
@ -5390,6 +5389,33 @@ _p9k_prompt_wifi_async() {
fi
done
[[ -n $ssid && -n $last_tx_rate ]] || return 0
# Output example (https://wiki.termux.com/wiki/Termux-wifi-connectioninfo):
#
# {
# "bssid": "02:00:00:00:00:00",
# "frequency_mhz": 2412,
# "ip": "100.64.135.224",
# "link_speed_mbps": 117,
# "mac_address": "02:00:00:00:00:00",
# "network_id": -1,
# "rssi": -65,
# "ssid": "<unknown ssid>",
# "ssid_hidden": true,
# "supplicant_state": "COMPLETED"
# }
elif (( _POWERLEVEL9K_USE_DANGEROUS_TERMUX_API && $+commands[termux-wifi-connectioninfo] )); then
local json
json=$(command termux-wifi-connectioninfo) || return 0
[[ $json == *'"supplicant_state"'[[:space:]]#:[[:space:]]#'"COMPLETED"' ]] || return 0
local -a match mbegin mend
[[ $json == (#b)*'"rssi"'[[:space:]]#:[[:space:]]#(()) ]] || return 0
on=1
rssi=$(jq -nr "$info | .rssi")
last_tx_rate=$(jq -nr "$info | .link_speed_mbps")
if [[ $(jq -nr "$info | .ssid_hidden") == false ]]; then
ssid=$(jq -nr "$info | .ssid")
fi
else
return 0
fi
@ -6740,9 +6766,9 @@ function _p9k_clear_instant_prompt() {
echo -E - ""
echo -E - "${(%):-For details, see:}"
if (( _p9k_term_has_href )); then
echo - "${(%):-\e]8;;https://github.com/romkatv/powerlevel10k#instant-prompt\ahttps://github.com/romkatv/powerlevel10k#instant-prompt\e]8;;\a}"
echo - "${(%):-\e]8;;https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt\ahttps://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt\e]8;;\a}"
else
echo - "${(%):-https://github.com/romkatv/powerlevel10k#instant-prompt}"
echo - "${(%):-https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt}"
fi
echo -E - ""
echo - "${(%):-%3F-- console output produced during zsh initialization follows --%f}"
@ -7433,6 +7459,10 @@ _p9k_init_params() {
_p9k_declare -i POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES
_p9k_declare -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS -- context dir vcs
_p9k_declare -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS -- status root_indicator background_jobs history time
# By default, powerlevel10k won't invoke Termux API utilities because
# they can hang. See https://github.com/termux/termux-packages/issues/334.
# This option allows powerlevel10k to make these calls.
_p9k_declare -b POWERLEVEL9K_USE_DANGEROUS_TERMUX_API 0
_p9k_declare -b POWERLEVEL9K_DISABLE_RPROMPT 0
_p9k_declare -b POWERLEVEL9K_PROMPT_ADD_NEWLINE 0
_p9k_declare -b POWERLEVEL9K_PROMPT_ON_NEWLINE 0
@ -9007,9 +9037,9 @@ _p9k_init() {
>&2 echo -E - ""
>&2 echo -E - "${(%):- - %BRecommended%b: Change the way Powerlevel10k is loaded from %B$__p9k_zshrc_u%b.}"
if (( _p9k_term_has_href )); then
>&2 echo - "${(%):- See \e]8;;https://github.com/romkatv/powerlevel10k#installation\ahttps://github.com/romkatv/powerlevel10k#installation\e]8;;\a.}"
>&2 echo - "${(%):- See \e]8;;https://github.com/romkatv/powerlevel10k/blob/master/README.md#installation\ahttps://github.com/romkatv/powerlevel10k/blob/master/README.md#installation\e]8;;\a.}"
else
>&2 echo - "${(%):- See https://github.com/romkatv/powerlevel10k#installation.}"
>&2 echo - "${(%):- See https://github.com/romkatv/powerlevel10k/blob/master/README.md#installation.}"
fi
if (( $+zsh_defer_options )); then
>&2 echo -E - ""
@ -9483,7 +9513,7 @@ if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file && -n $__p9k_instant_p
zf_rm -f -- $__p9k_instant_prompt_dump_file{,.zwc} 2>/dev/null
fi
typeset -g P9K_VERSION=1.20.10
typeset -g P9K_VERSION=1.20.8
unset VSCODE_SHELL_INTEGRATION
_p9k_init_ssh

@ -1506,7 +1506,7 @@ function ask_empty_line() {
}
function print_instant_prompt_link() {
local link='https://github.com/romkatv/powerlevel10k#instant-prompt'
local link='https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt'
(( wizard_columns < $#link )) && return
print
flowing -c "$(href $link)"
@ -2142,16 +2142,16 @@ while true; do
elif (( ! cap_diamond )); then
POWERLEVEL9K_MODE=awesome-fontconfig
else
ask_arrow '\UF0737' || continue
ask_arrow '\uFC35' || continue
if (( cap_arrow )); then
ask_width || continue
fi
if (( cap_arrow )); then
POWERLEVEL9K_MODE=nerdfont-v3
POWERLEVEL9K_MODE=nerdfont-complete
else
ask_arrow '\uFC35' "Let's try another one." || continue
ask_arrow '\UF0737' "Let's try another one." || continue
if (( cap_arrow )); then
ask_width || continue
fi
if (( cap_arrow )); then
POWERLEVEL9K_MODE=nerdfont-complete
POWERLEVEL9K_MODE=nerdfont-v3
else
POWERLEVEL9K_MODE=awesome-fontconfig
ask_python || continue

Loading…
Cancel
Save