1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-22 23:08:01 +00:00

[p10k] Add hcloud prompt

This commit is contained in:
Daniel Carrillo 2022-01-04 15:37:40 +01:00
parent 2df2a9ec0e
commit 3e5f0cfd1c
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16

View File

@ -101,6 +101,7 @@
# battery # internal battery # battery # internal battery
# wifi # wifi speed # wifi # wifi speed
# example # example user-defined segment (see prompt_example function below) # example # example user-defined segment (see prompt_example function below)
hcloud
) )
# Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you. # Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you.
@ -1526,6 +1527,19 @@
# Custom prefix. # Custom prefix.
# typeset -g POWERLEVEL9K_TIME_PREFIX='%fat ' # typeset -g POWERLEVEL9K_TIME_PREFIX='%fat '
typeset -g POWERLEVEL9K_HCLOUD_SHOW_ON_COMMAND='hcloud'
typeset -g POWERLEVEL9K_HCLOUD_FOREGROUND=214
function prompt_hcloud() {
hcloud_file="$HOME/.config/hcloud/cli.toml"
if [ -f $hcloud_file ] ; then
context=$(fgrep active_context $hcloud_file | cut -f 2 -d "=" | tr -d " \"")
p10k segment -f 208 -i '' -t "$context"
fi
}
function instant_prompt_hcloud() {
prompt_hcloud
}
# Example of a user-defined prompt segment. Function prompt_example will be called on every # Example of a user-defined prompt segment. Function prompt_example will be called on every
# prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or # prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or
# POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and orange text greeting the user. # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and orange text greeting the user.