From 24a5261a395d5e1d531275b70ed48de479abe38a Mon Sep 17 00:00:00 2001 From: romkatv Date: Wed, 7 Aug 2019 11:04:35 +0200 Subject: [PATCH] wizard: enable os_icon for users who like many icons --- config/p10k-classic.zsh | 3 +- config/p10k-lean.zsh | 2 +- internal/configure.zsh | 2 +- internal/p10k.zsh | 9 ++++-- internal/wizard.zsh | 66 ++++++++++++++++++++++++++++++++++++----- 5 files changed, 69 insertions(+), 13 deletions(-) diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index b0fc9a8..ce42b9a 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -25,6 +25,7 @@ fi # The list of segments shown on the left. Fill it with the most important segments. typeset -ga POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( # =========================[ Line #1 ]========================= + # os_icon # os identifier dir # current directory vcs # git status # =========================[ Line #2 ]========================= @@ -173,7 +174,7 @@ fi #################################[ os_icon: os identifier ]################################## # Foreground color. - typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=7 + typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=209 # Display this icon instead of the default. # typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='⭐' diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index ef9ab64..db1900e 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -163,7 +163,7 @@ fi #################################[ os_icon: os identifier ]################################## # OS identifier color. - typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=212 + typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=209 # Display this icon instead of the default. # typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='⭐' diff --git a/internal/configure.zsh b/internal/configure.zsh index 5b05429..d7a253d 100644 --- a/internal/configure.zsh +++ b/internal/configure.zsh @@ -1,4 +1,4 @@ -typeset -gr __p9k_wizard_columns=76 +typeset -gr __p9k_wizard_columns=80 typeset -gr __p9k_wizard_lines=21 typeset -gr __p9k_zd=${${ZDOTDIR:-$HOME}:A} typeset -gr __p9k_zd_u=${${${(q-)__p9k_zd}/#(#b)$HOME(|\/*)/'~'$match[1]}//\%/%%} diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 017b5c2..035475d 100755 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -4037,9 +4037,12 @@ _p9k_init() { Linux) _p9k_os='Linux' local os_release_id - [[ -f /etc/os-release && - "${(f)$((/dev/null)}" =~ "ID=([A-Za-z]+)" ]] && os_release_id="${match[1]}" - case "$os_release_id" in + if [[ -r /etc/os-release ]]; then + local lines=(${(f)"$(/dev/null)" == Android ]]; then + echo ANDROID_ICON + else + case $uname in + SunOS) echo SUNOS_ICON;; + Darwin) echo APPLE_ICON;; + CYGWIN_NT-* | MSYS_NT-*) echo WINDOWS_ICON;; + FreeBSD|OpenBSD|DragonFly) echo FREEBSD_ICON;; + Linux) + local os_release_id + if [[ -r /etc/os-release ]]; then + local lines=(${(f)"$(