Merge pull request #1362 from arisinfenix/de_version

Add initial support for DE version
This commit is contained in:
dylan 2019-12-09 21:03:57 +02:00 committed by GitHub
commit 53ac061240
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 14 deletions

View File

@ -383,6 +383,17 @@ public_ip_host="http://ident.me"
public_ip_timeout=2 public_ip_timeout=2
# Desktop Environment
# Show Desktop Environment version
#
# Default: 'off'
# Values: 'on', 'off'
# Flag: --de_version
de_version="off"
# Disk # Disk
@ -1581,24 +1592,41 @@ get_de() {
# Format strings. # Format strings.
case $de in case $de in
KDE_SESSION_VERSION*) de=KDE${de/* = } ;; KDE_SESSION_VERSION*) de=KDE${de/* = } ;;
*xfce4*) de=Xfce4 ;; *xfce4*) de=Xfce4 ;;
*xfce5*) de=Xfce5 ;; *xfce5*) de=Xfce5 ;;
*xfce*) de=Xfce ;; *xfce*) de=Xfce ;;
*mate*) de=MATE ;; *mate*) de=MATE ;;
*GNOME*) de=GNOME ;;
*MUFFIN*|Cinnamon) *MUFFIN*) de=Cinnamon ;;
de=$(cinnamon --version)
de=${de:-Cinnamon}
;;
*GNOME*)
de=$(gnome-shell --version)
de=${de/Shell }
;;
esac esac
((KDE_SESSION_VERSION >= 4)) && de=${de/KDE/Plasma} ((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 de_run=1
} }
@ -2752,6 +2780,9 @@ get_style() {
# Get DE if user has disabled the function. # Get DE if user has disabled the function.
((de_run != 1)) && get_de ((de_run != 1)) && get_de
# Remove version from '$de'.
[[ $de_version == on ]] && de=${de/ *}
# Check for DE Theme. # Check for DE Theme.
case $de in case $de in
"KDE"* | "Plasma"*) "KDE"* | "Plasma"*)
@ -4523,6 +4554,7 @@ INFO:
NOTE: This only supports Linux. NOTE: This only supports Linux.
--de_version on/off Show/Hide Desktop Environment version
--gtk_shorthand on/off Shorten output of gtk theme/icons --gtk_shorthand on/off Shorten output of gtk theme/icons
--gtk2 on/off Enable/Disable gtk2 theme/font/icons output --gtk2 on/off Enable/Disable gtk2 theme/font/icons output
--gtk3 on/off Enable/Disable gtk3 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_brand") gpu_brand="$2" ;;
"--gpu_type") gpu_type="$2" ;; "--gpu_type") gpu_type="$2" ;;
"--refresh_rate") refresh_rate="$2" ;; "--refresh_rate") refresh_rate="$2" ;;
"--de_version") de_version="$2" ;;
"--gtk_shorthand") gtk_shorthand="$2" ;; "--gtk_shorthand") gtk_shorthand="$2" ;;
"--gtk2") gtk2="$2" ;; "--gtk2") gtk2="$2" ;;
"--gtk3") gtk3="$2" ;; "--gtk3") gtk3="$2" ;;

View File

@ -104,6 +104,9 @@ Which GPU to display. (all, dedicated, integrated)
.IP .IP
NOTE: This only supports Linux. NOTE: This only supports Linux.
.TP .TP
\fB\-\-de_version\fR on/off
Show/Hide Desktop Environment version
.TP
\fB\-\-gtk_shorthand\fR on/off \fB\-\-gtk_shorthand\fR on/off
Shorten output of gtk theme/icons Shorten output of gtk theme/icons
.TP .TP