diff --git a/neofetch b/neofetch index 76668543..a0339c2b 100755 --- a/neofetch +++ b/neofetch @@ -383,6 +383,17 @@ public_ip_host="http://ident.me" public_ip_timeout=2 +# Desktop Environment + + +# Show Desktop Environment version +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --de_version +de_version="off" + + # Disk @@ -1581,24 +1592,41 @@ get_de() { # Format strings. case $de in KDE_SESSION_VERSION*) de=KDE${de/* = } ;; - *xfce4*) de=Xfce4 ;; - *xfce5*) de=Xfce5 ;; - *xfce*) de=Xfce ;; - *mate*) de=MATE ;; - - *MUFFIN*|Cinnamon) - de=$(cinnamon --version) - de=${de:-Cinnamon} - ;; - - *GNOME*) - de=$(gnome-shell --version) - de=${de/Shell } - ;; + *xfce4*) de=Xfce4 ;; + *xfce5*) de=Xfce5 ;; + *xfce*) de=Xfce ;; + *mate*) de=MATE ;; + *GNOME*) de=GNOME ;; + *MUFFIN*) de=Cinnamon ;; esac ((KDE_SESSION_VERSION >= 4)) && de=${de/KDE/Plasma} + if [[ $de_version == on && $de ]]; then + case $de in + "Plasma"*) de_ver=$(plasmashell --version) ;; + "MATE"*) de_ver=$(mate-session --version) ;; + "Xfce"*) de_ver=$(xfce4-session --version) ;; + "GNOME"*) de_ver=$(gnome-shell --version) ;; + "Cinnamon"*) de_ver=$(cinnamon --version) ;; + "Deepin"*) de_ver=$(awk -F'=' '/Version/ {print $2}' /etc/deepin-version) ;; + "Budgie"*) de_ver=$(budgie-desktop --version) ;; + "LXQt"*) de_ver=$(lxqt-session --version) ;; + "Lumina"*) de_ver=$(lumina-desktop --version 2>&1) ;; + "Trinity"*) de_ver=$(tde-config --version) ;; + esac + + de_ver=${de_ver/*TDE:} + de_ver=${de_ver/tde-config*} + de_ver=${de_ver/liblxqt*} + de_ver=${de_ver/Copyright*} + de_ver=${de_ver/)*} + de_ver=${de_ver/* } + de_ver=${de_ver//\"} + + de="$de $de_ver" + fi + de_run=1 } @@ -2752,6 +2780,9 @@ get_style() { # Get DE if user has disabled the function. ((de_run != 1)) && get_de + # Remove version from '$de'. + [[ $de_version == on ]] && de=${de/ *} + # Check for DE Theme. case $de in "KDE"* | "Plasma"*) @@ -4523,6 +4554,7 @@ INFO: NOTE: This only supports Linux. + --de_version on/off Show/Hide Desktop Environment version --gtk_shorthand on/off Shorten output of gtk theme/icons --gtk2 on/off Enable/Disable gtk2 theme/font/icons output --gtk3 on/off Enable/Disable gtk3 theme/font/icons output @@ -4698,6 +4730,7 @@ get_args() { "--gpu_brand") gpu_brand="$2" ;; "--gpu_type") gpu_type="$2" ;; "--refresh_rate") refresh_rate="$2" ;; + "--de_version") de_version="$2" ;; "--gtk_shorthand") gtk_shorthand="$2" ;; "--gtk2") gtk2="$2" ;; "--gtk3") gtk3="$2" ;; diff --git a/neofetch.1 b/neofetch.1 index 292d092e..bd953323 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -104,6 +104,9 @@ Which GPU to display. (all, dedicated, integrated) .IP NOTE: This only supports Linux. .TP +\fB\-\-de_version\fR on/off +Show/Hide Desktop Environment version +.TP \fB\-\-gtk_shorthand\fR on/off Shorten output of gtk theme/icons .TP