From 1b1bfa2dab3c1959757a45a5383172d1112178a7 Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 16 Feb 2016 10:19:28 +1100 Subject: [PATCH 1/7] Added experimental KDE theme detection to getgtk --- fetch | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/fetch b/fetch index 8a270fd1..e92a59d9 100755 --- a/fetch +++ b/fetch @@ -1155,6 +1155,7 @@ getgtk () { gsettings="gtk-theme" gconf="gtk_theme" xfconf="ThemeName" + kde="widgetStyle" ;; icons) @@ -1162,6 +1163,7 @@ getgtk () { gsettings="icon-theme" gconf="icon_theme" xfconf="IconThemeName" + kde="Theme" ;; font) @@ -1169,6 +1171,7 @@ getgtk () { gsettings="font-name" gconf="font_theme" xfconf="FontName" + kde="font" ;; esac @@ -1178,6 +1181,19 @@ getgtk () { desktop=${desktop^} case "$desktop" in + "KDE"*) + if type -p kde5-config >/dev/null 2>&1; then + kde_config_dir=$(kde5-config --localprefix) + + if [ -f "${kde_config_dir}/share/config/kdeglobals" ]; then + kde_config_file="${kde_config_dir}/share/config/kdeglobals" + + gtk3theme=$(grep "^[^#]*$kde" "$kde_config_file") + gtk3theme=${gtk3theme/${kde}*=} + fi + fi + ;; + "Cinnamon") if type -p gsettings >/dev/null 2>&1; then gtk3theme=$(gsettings get org.cinnamon.desktop.interface $gsettings) From 0427eb3f0537a7083a2b0ed9e27ecf68b18c7e04 Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 16 Feb 2016 10:31:13 +1100 Subject: [PATCH 2/7] Add support for older KDE versions --- fetch | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/fetch b/fetch index e92a59d9..304234cd 100755 --- a/fetch +++ b/fetch @@ -1185,12 +1185,18 @@ getgtk () { if type -p kde5-config >/dev/null 2>&1; then kde_config_dir=$(kde5-config --localprefix) - if [ -f "${kde_config_dir}/share/config/kdeglobals" ]; then - kde_config_file="${kde_config_dir}/share/config/kdeglobals" + elif type -p kde4-config >/dev/null 2>&1; then + kde_config_dir=$(kde4-config --localprefix) - gtk3theme=$(grep "^[^#]*$kde" "$kde_config_file") - gtk3theme=${gtk3theme/${kde}*=} - fi + elif type -p kde-config >/dev/null 2>&1; then + kde_config_dir=$(kde-config --localprefix) + fi + + if [ -f "${kde_config_dir}/share/config/kdeglobals" ]; then + kde_config_file="${kde_config_dir}/share/config/kdeglobals" + + gtk3theme=$(grep "^[^#]*$kde" "$kde_config_file") + gtk3theme=${gtk3theme/${kde}*=} fi ;; From 98f1a0e057e13df0328ce5f639e695cc2738bcf0 Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 16 Feb 2016 10:42:38 +1100 Subject: [PATCH 3/7] If KDE theme is found don't look for GTK2/3 Themes --- fetch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fetch b/fetch index 304234cd..cf8308ed 100755 --- a/fetch +++ b/fetch @@ -1195,8 +1195,9 @@ getgtk () { if [ -f "${kde_config_dir}/share/config/kdeglobals" ]; then kde_config_file="${kde_config_dir}/share/config/kdeglobals" - gtk3theme=$(grep "^[^#]*$kde" "$kde_config_file") - gtk3theme=${gtk3theme/${kde}*=} + gtktheme=$(grep "^[^#]*$kde" "$kde_config_file") + gtktheme=${gtk3theme/${kde}*=} + return fi ;; From bb2e0210debf5776541ddbc67f45961c86dea9ed Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 16 Feb 2016 10:49:21 +1100 Subject: [PATCH 4/7] getgtk has been renamed to getstyle and is now a generic function that prints the GTK/QT theme --- fetch | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/fetch b/fetch index cf8308ed..3bab0485 100755 --- a/fetch +++ b/fetch @@ -47,8 +47,8 @@ printinfo () { info "Shell" shell info "Desktop Environment" de info "Window Manager" wm - info "GTK Theme" gtktheme - info "Icons" gtkicons + info "Theme" theme + info "Icons" icons info "CPU" cpu info "GPU" gpu info "Memory" memory @@ -1142,9 +1142,9 @@ getresolution () { # }}} -# GTK Theme/Icons/Font {{{ +# Theme/Icons/Font {{{ -getgtk () { +getstyle () { # Fix weird output when the function # is run multiple times. unset gtk2theme gtk3theme @@ -1195,8 +1195,10 @@ getgtk () { if [ -f "${kde_config_dir}/share/config/kdeglobals" ]; then kde_config_file="${kde_config_dir}/share/config/kdeglobals" - gtktheme=$(grep "^[^#]*$kde" "$kde_config_file") - gtktheme=${gtk3theme/${kde}*=} + theme=$(grep "^[^#]*$kde" "$kde_config_file") + theme=${gtk3theme/${kde}*=} + + gtk_shorthand="on" return fi ;; @@ -1281,31 +1283,31 @@ getgtk () { fi # Final string - gtktheme="${gtk2theme}${gtk3theme}" + theme="${gtk2theme}${gtk3theme}" # If the final string is empty print "None" - [ -z "$gtktheme" ] && gtktheme="None" + [ -z "$theme" ] && theme="None" # Make the output shorter by removing "[GTKX]" from the string if [ "$gtk_shorthand" == "on" ]; then - gtktheme=${gtktheme/ '[GTK2]'} - gtktheme=${gtktheme/ '[GTK3]'} - gtktheme=${gtktheme/ '[GTK2/3]'} + theme=${theme/ '[GTK2]'} + theme=${theme/ '[GTK3]'} + theme=${theme/ '[GTK2/3]'} fi } -getgtktheme () { - getgtk theme +gettheme () { + getstyle theme } -getgtkicons () { - getgtk icons - gtkicons="$gtktheme" +geticons () { + getstyle icons + icons="$theme" } -getgtkfont () { - getgtk font - gtkfont="$gtktheme" +getfont () { + getstyle font + font="$theme" } # }}} From 1b3e0e71bb8d5e9a230ece651622b3c99857e50e Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 16 Feb 2016 10:50:40 +1100 Subject: [PATCH 5/7] Update config --- config/config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config b/config/config index 69887d31..dfba9567 100644 --- a/config/config +++ b/config/config @@ -28,8 +28,8 @@ printinfo () { info "Shell" shell info "Desktop Environment" de info "Window Manager" wm - info "GTK Theme" gtktheme - info "Icons" gtkicons + info "Theme" theme + info "Icons" icons info "CPU" cpu info "GPU" gpu info "Memory" memory From c4bd708a09244ed4487506a19a44782fc3f7f600 Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 16 Feb 2016 10:52:26 +1100 Subject: [PATCH 6/7] Fix stray gtktheme string --- fetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch b/fetch index 3bab0485..d217021a 100755 --- a/fetch +++ b/fetch @@ -1196,7 +1196,7 @@ getstyle () { kde_config_file="${kde_config_dir}/share/config/kdeglobals" theme=$(grep "^[^#]*$kde" "$kde_config_file") - theme=${gtk3theme/${kde}*=} + theme=${theme/${kde}*=} gtk_shorthand="on" return From 0d2db03909d35dc64639a6d48cb12c0240e7db96 Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 16 Feb 2016 10:53:12 +1100 Subject: [PATCH 7/7] Uppercase first letter in KDE theme output --- fetch | 1 + 1 file changed, 1 insertion(+) diff --git a/fetch b/fetch index d217021a..6847c471 100755 --- a/fetch +++ b/fetch @@ -1197,6 +1197,7 @@ getstyle () { theme=$(grep "^[^#]*$kde" "$kde_config_file") theme=${theme/${kde}*=} + theme=${theme^} gtk_shorthand="on" return