mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-19 22:11:57 +00:00
add proxy
prompt segment
This commit is contained in:
parent
3f2f38a71e
commit
0c627eb31d
4 changed files with 29 additions and 0 deletions
|
@ -65,6 +65,7 @@ fi
|
|||
# =========================[ Line #2 ]=========================
|
||||
newline
|
||||
# public_ip # public IP address
|
||||
# proxy # system-wide http/https/ftp proxy
|
||||
# battery # internal battery
|
||||
# example # example user-defined segment (see prompt_example function below)
|
||||
)
|
||||
|
@ -626,6 +627,12 @@ fi
|
|||
# Custom icon.
|
||||
# typeset -g POWERLEVEL9K_PUBLIC_IP_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
|
||||
#########################[ proxy: system-wide http/https/ftp proxy ]##########################
|
||||
# Proxy color.
|
||||
typeset -g POWERLEVEL9K_PROXY_FOREGROUND=68
|
||||
# Custom icon.
|
||||
# typeset -g POWERLEVEL9K_PROXY_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
|
||||
################################[ battery: internal battery ]#################################
|
||||
# Show battery in red when it's below this level and not connected to power supply.
|
||||
typeset -g POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20
|
||||
|
|
|
@ -65,6 +65,7 @@ fi
|
|||
# =========================[ Line #2 ]=========================
|
||||
newline
|
||||
# public_ip # public IP address
|
||||
# proxy # system-wide http/https/ftp proxy
|
||||
# battery # internal battery
|
||||
# example # example user-defined segment (see prompt_example function below)
|
||||
)
|
||||
|
@ -609,6 +610,12 @@ fi
|
|||
# Custom icon.
|
||||
# typeset -g POWERLEVEL9K_PUBLIC_IP_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
|
||||
#########################[ proxy: system-wide http/https/ftp proxy ]##########################
|
||||
# Proxy color.
|
||||
typeset -g POWERLEVEL9K_PROXY_FOREGROUND=68
|
||||
# Custom icon.
|
||||
# typeset -g POWERLEVEL9K_PROXY_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
|
||||
################################[ battery: internal battery ]#################################
|
||||
# Show battery in red when it's below this level and not connected to power supply.
|
||||
typeset -g POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20
|
||||
|
|
|
@ -112,6 +112,7 @@ function _p9k_init_icons() {
|
|||
LARAVEL_ICON ''
|
||||
RANGER_ICON '\u2B50' # ⭐
|
||||
TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️
|
||||
PROXY_ICON '\u21AF' # ↯
|
||||
)
|
||||
;;
|
||||
'awesome-fontconfig')
|
||||
|
@ -211,6 +212,7 @@ function _p9k_init_icons() {
|
|||
LARAVEL_ICON ''
|
||||
RANGER_ICON '\u2B50' # ⭐
|
||||
TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️
|
||||
PROXY_ICON '\u21AF' # ↯
|
||||
)
|
||||
;;
|
||||
'awesome-mapped-fontconfig')
|
||||
|
@ -314,6 +316,7 @@ function _p9k_init_icons() {
|
|||
LARAVEL_ICON ''
|
||||
RANGER_ICON '\u2B50' # ⭐
|
||||
TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️
|
||||
PROXY_ICON '\u21AF' # ↯
|
||||
)
|
||||
;;
|
||||
'nerdfont-complete'|'nerdfont-fontconfig')
|
||||
|
@ -414,6 +417,7 @@ function _p9k_init_icons() {
|
|||
LARAVEL_ICON '\ue73f' #
|
||||
RANGER_ICON '\u2B50' # ⭐
|
||||
TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️
|
||||
PROXY_ICON '\u21AF' # ↯
|
||||
)
|
||||
;;
|
||||
*)
|
||||
|
@ -513,6 +517,7 @@ function _p9k_init_icons() {
|
|||
LARAVEL_ICON ''
|
||||
RANGER_ICON '\u2B50' # ⭐
|
||||
TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️
|
||||
PROXY_ICON '\u21AF' # ↯
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -3052,6 +3052,16 @@ function prompt_terraform() {
|
|||
[[ $ws == default ]] || _p9k_prompt_segment $0 $_p9k_color1 blue TERRAFORM_ICON 0 '' $ws
|
||||
}
|
||||
|
||||
function prompt_proxy() {
|
||||
local -U p=(
|
||||
$all_proxy $http_proxy $https_proxy $ftp_proxy
|
||||
$ALL_PROXY $HTTP_PROXY $HTTPS_PROXY $FTP_PROXY)
|
||||
p=(${(@)${(@)${(@)p#*://}##*@}%%/*})
|
||||
(( $#p )) || return
|
||||
(( $#p == 1 )) || p=("")
|
||||
_p9k_prompt_segment $0 $_p9k_color1 blue PROXY_ICON 0 '' "$p[1]"
|
||||
}
|
||||
|
||||
_p9k_preexec() {
|
||||
if (( $+_p9k_real_zle_rprompt_indent )); then
|
||||
if [[ -n $_p9k_real_zle_rprompt_indent ]]; then
|
||||
|
|
Loading…
Reference in a new issue