From cfe1014d1a6633e53975d6fd808f40a9dd4c63b0 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sat, 7 Dec 2019 18:00:58 +0100 Subject: [PATCH 01/15] Add initial support for DE version --- neofetch | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/neofetch b/neofetch index 76668543..e6a45c8a 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 @@ -1599,6 +1610,17 @@ get_de() { ((KDE_SESSION_VERSION >= 4)) && de=${de/KDE/Plasma} + if [[ $de_version == on && $de ]]; then + case $de in + "Plasma"*) + de_ver=$(plasmashell --version) + de_ver=${de_ver/* } + ;; + # TODO: Add other DEs + esac + de="$de $de_ver" + fi + de_run=1 } @@ -2752,6 +2774,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 +4548,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 +4724,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" ;; From 5ef4772bf02a48c9eeeab976aad37ceafd03e28f Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 8 Dec 2019 15:30:16 +0100 Subject: [PATCH 02/15] de_version: Add MATE --- neofetch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neofetch b/neofetch index e6a45c8a..d1fa01a0 100755 --- a/neofetch +++ b/neofetch @@ -1616,6 +1616,10 @@ get_de() { de_ver=$(plasmashell --version) de_ver=${de_ver/* } ;; + "MATE"*) + de_ver=$(mate-session --version) + de_ver=${de_ver/* } + ;; # TODO: Add other DEs esac de="$de $de_ver" From 2d4ea78f7fd30ebaaedfdbcea77361b3c6bb0f93 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 8 Dec 2019 15:36:15 +0100 Subject: [PATCH 03/15] de_version: Add Xfce --- neofetch | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/neofetch b/neofetch index d1fa01a0..813ae5c3 100755 --- a/neofetch +++ b/neofetch @@ -1620,6 +1620,11 @@ get_de() { de_ver=$(mate-session --version) de_ver=${de_ver/* } ;; + "Xfce"*) + de_ver=$(xfce4-session --version) + de_ver=${de_ver/)*} + de_ver=${de_ver/* } + ;; # TODO: Add other DEs esac de="$de $de_ver" From 3c0d86bb59d5003c99c785e0ea00322e83efb32b Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 8 Dec 2019 16:05:06 +0100 Subject: [PATCH 04/15] de_version: Add GNOME --- neofetch | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index 813ae5c3..6c484dbf 100755 --- a/neofetch +++ b/neofetch @@ -1596,16 +1596,12 @@ get_de() { *xfce5*) de=Xfce5 ;; *xfce*) de=Xfce ;; *mate*) de=MATE ;; + *GNOME*) de=GNOME ;; *MUFFIN*|Cinnamon) de=$(cinnamon --version) de=${de:-Cinnamon} ;; - - *GNOME*) - de=$(gnome-shell --version) - de=${de/Shell } - ;; esac ((KDE_SESSION_VERSION >= 4)) && de=${de/KDE/Plasma} @@ -1625,6 +1621,10 @@ get_de() { de_ver=${de_ver/)*} de_ver=${de_ver/* } ;; + "GNOME"*) + de_ver=$(gnome-shell --version) + de_ver=${de_ver/* } + ;; # TODO: Add other DEs esac de="$de $de_ver" From 22d1071d570dabc8326205c0c90d6dccf2a508b1 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 8 Dec 2019 16:17:39 +0100 Subject: [PATCH 05/15] de_version: simplify --- neofetch | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/neofetch b/neofetch index 6c484dbf..14cf0d55 100755 --- a/neofetch +++ b/neofetch @@ -1608,25 +1608,15 @@ get_de() { if [[ $de_version == on && $de ]]; then case $de in - "Plasma"*) - de_ver=$(plasmashell --version) - de_ver=${de_ver/* } - ;; - "MATE"*) - de_ver=$(mate-session --version) - de_ver=${de_ver/* } - ;; - "Xfce"*) - de_ver=$(xfce4-session --version) - de_ver=${de_ver/)*} - de_ver=${de_ver/* } - ;; - "GNOME"*) - de_ver=$(gnome-shell --version) - de_ver=${de_ver/* } - ;; + "Plasma"*) de_ver=$(plasmashell --version) ;; + "MATE"*) de_ver=$(mate-session --version) ;; + "Xfce"*) de_ver=$(xfce4-session --version) ;; + "GNOME"*) de_ver=$(gnome-shell --version) ;; # TODO: Add other DEs esac + de_ver=${de_ver/)*} + de_ver=${de_ver/* } + de="$de $de_ver" fi From cfde63b5f4fd296390077814a4b743fc2c664aac Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 8 Dec 2019 18:33:50 +0100 Subject: [PATCH 06/15] de_version: Add Cinnamon --- neofetch | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/neofetch b/neofetch index 14cf0d55..64ca40a3 100755 --- a/neofetch +++ b/neofetch @@ -1597,21 +1597,18 @@ get_de() { *xfce*) de=Xfce ;; *mate*) de=MATE ;; *GNOME*) de=GNOME ;; - - *MUFFIN*|Cinnamon) - de=$(cinnamon --version) - de=${de:-Cinnamon} - ;; + *MUFFIN*|Cinnamon) 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) ;; + "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) ;; # TODO: Add other DEs esac de_ver=${de_ver/)*} From 9303077f0e6ba7f586832f31e342bd22989d9494 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 8 Dec 2019 19:19:28 +0100 Subject: [PATCH 07/15] de_version: Add Deepin --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 64ca40a3..5edab4d9 100755 --- a/neofetch +++ b/neofetch @@ -1609,6 +1609,7 @@ get_de() { "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) ;; # TODO: Add other DEs esac de_ver=${de_ver/)*} From 02fe4815407eaf20330841201abf403d5a40112b Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 8 Dec 2019 19:47:58 +0100 Subject: [PATCH 08/15] de_version: Add Budgie --- neofetch | 2 ++ 1 file changed, 2 insertions(+) diff --git a/neofetch b/neofetch index 5edab4d9..e1536f8d 100755 --- a/neofetch +++ b/neofetch @@ -1610,8 +1610,10 @@ get_de() { "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) ;; # TODO: Add other DEs esac + de_ver=${de_ver/Copyright*} de_ver=${de_ver/)*} de_ver=${de_ver/* } From 96199eab1c58f88383250ec7073bea1982f2f61d Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Mon, 9 Dec 2019 17:21:12 +0100 Subject: [PATCH 09/15] de_version: Add LXQt --- neofetch | 2 ++ 1 file changed, 2 insertions(+) diff --git a/neofetch b/neofetch index e1536f8d..98db37e8 100755 --- a/neofetch +++ b/neofetch @@ -1611,8 +1611,10 @@ get_de() { "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) ;; # TODO: Add other DEs esac + de_ver=${de_ver/liblxqt*} de_ver=${de_ver/Copyright*} de_ver=${de_ver/)*} de_ver=${de_ver/* } From 5070c39595c4f10214c8432b71564d4be4040bfc Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Mon, 9 Dec 2019 17:27:03 +0100 Subject: [PATCH 10/15] de_version: Add Lumina --- neofetch | 2 ++ 1 file changed, 2 insertions(+) diff --git a/neofetch b/neofetch index 98db37e8..efd85648 100755 --- a/neofetch +++ b/neofetch @@ -1612,12 +1612,14 @@ get_de() { "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) ;; # TODO: Add other DEs esac 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 From 8c2ab8e4436b0f707fe7b7240b4d9fdcb684404f Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Mon, 9 Dec 2019 17:54:42 +0100 Subject: [PATCH 11/15] de_version: Add Trinity --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index efd85648..d8049310 100755 --- a/neofetch +++ b/neofetch @@ -1613,6 +1613,7 @@ get_de() { "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 | awk '/TDE:/ {print $2}') ;; # TODO: Add other DEs esac de_ver=${de_ver/liblxqt*} From 9f75eaece23a3d41a0993755473e93a03487221c Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Mon, 9 Dec 2019 18:17:10 +0100 Subject: [PATCH 12/15] de_version: Avoid awk --- neofetch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index d8049310..ab84ee06 100755 --- a/neofetch +++ b/neofetch @@ -1613,9 +1613,11 @@ get_de() { "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 | awk '/TDE:/ {print $2}') ;; + "Trinity"*) de_ver=$(tde-config --version) ;; # TODO: Add other DEs 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/)*} From 3192036f324bf7e82ea6c28e47dc735c061437f6 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Mon, 9 Dec 2019 18:36:49 +0100 Subject: [PATCH 13/15] de_version: Remove comment --- neofetch | 1 - 1 file changed, 1 deletion(-) diff --git a/neofetch b/neofetch index ab84ee06..b896ce1f 100755 --- a/neofetch +++ b/neofetch @@ -1614,7 +1614,6 @@ get_de() { "LXQt"*) de_ver=$(lxqt-session --version) ;; "Lumina"*) de_ver=$(lumina-desktop --version 2>&1) ;; "Trinity"*) de_ver=$(tde-config --version) ;; - # TODO: Add other DEs esac de_ver=${de_ver/*TDE:} de_ver=${de_ver/tde-config*} From 1ac90be01d44c3869cea67c3ba556a6f9a549b91 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Mon, 9 Dec 2019 19:07:05 +0100 Subject: [PATCH 14/15] de_version: apply review comments --- neofetch | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/neofetch b/neofetch index b896ce1f..a0339c2b 100755 --- a/neofetch +++ b/neofetch @@ -1592,12 +1592,12 @@ 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 ;; - *GNOME*) de=GNOME ;; - *MUFFIN*|Cinnamon) de=Cinnamon ;; + *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} @@ -1615,6 +1615,7 @@ get_de() { "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*} @@ -2779,7 +2780,7 @@ get_style() { # Get DE if user has disabled the function. ((de_run != 1)) && get_de - # remove version from $de + # Remove version from '$de'. [[ $de_version == on ]] && de=${de/ *} # Check for DE Theme. From ba93e1bb0db8405b55ee5202045ccb69ae38c91e Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Mon, 9 Dec 2019 19:22:24 +0100 Subject: [PATCH 15/15] Update man page --- neofetch.1 | 3 +++ 1 file changed, 3 insertions(+) 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