summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rwxr-xr-xpowerlevel9k.zsh-theme20
2 files changed, 21 insertions, 0 deletions
diff --git a/README.md b/README.md
index 73dcb7df..ef3207ac 100644
--- a/README.md
+++ b/README.md
@@ -136,6 +136,7 @@ The segments that are currently available are:
* [`custom_command`](#custom_command) - Create a custom segment to display the
output of an arbitrary command.
* [`todo`](http://todotxt.com/) - Shows the number of tasks in your todo.txt tasks file.
+* `detect-virt` - Virtualization detection with systemd
---------------------------------------------------------------------------------
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index d574e3b5..cdace7fa 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -547,6 +547,26 @@ prompt_history() {
"$1_prompt_segment" "$0" "$2" "244" "$DEFAULT_COLOR" '%h'
}
+# Detection for virtualization (systemd based systems only)
+prompt_detect_virt() {
+ if ! command -v systemd-detect-virt;then
+ return
+ fi
+ local virt=$(systemd-detect-virt)
+ local color="yellow"
+ if [[ "$virt" == "none" ]]; then
+ if [[ "$(ls -di / | grep -o 2)" != "2" ]]; then
+ virt="chroot"
+ "$1_prompt_segment" "$0" "$2" "$color" "$DEFAULT_COLOR" "$virt"
+ else
+ ;
+ fi
+ else
+ "$1_prompt_segment" "$0" "$2" "$color" "$DEFAULT_COLOR" "$virt"
+ fi
+}
+
+
prompt_icons_test() {
for key in ${(@k)icons}; do
# The lower color spectrum in ZSH makes big steps. Choosing