From c8e8cf5f994294b76dfb52677f90df6bc35308b6 Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 1 Apr 2016 14:50:15 +1100 Subject: [PATCH] Add support for kwin --- neofetch | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/neofetch b/neofetch index a198b31f..ff7f7500 100755 --- a/neofetch +++ b/neofetch @@ -822,7 +822,7 @@ getwmtheme () { 'Cinnamon' | 'Muffin') detheme="$(gsettings get org.cinnamon.theme name)" wmtheme="$(gsettings get org.cinnamon.desktop.wm.preferences theme)" - wmtheme="${detheme} (${wmtheme})" + wmtheme="$detheme (${wmtheme})" ;; 'Compiz' | 'Mutter'* | 'GNOME Shell' | 'Gala') @@ -873,6 +873,18 @@ getwmtheme () { wmtheme="$(xfconf-query -c xfwm4 -p /general/theme)" ;; + 'KWin'*) + kdeconfigdir + kde_config_dir=${kde_config_dir%/} + + if [ -f "$kde_config_dir/share/config/kwinrc" ]; then + wmtheme="$(awk '/PluginLib=kwin3_/{gsub(/PluginLib=kwin3_/,"",$0); print $0; exit}' "$kde_config_dir/share/config/kwinrc")" + + elif [ -f "$KDE_CONFIG_DIR/share/config/kdebugrc" ]; then + wmtheme="$(awk '/(decoration)/ {gsub(/\[/,"",$1); print $1; exit}' "$kde_config_dir/share/config/kdebugrc")" + fi + ;; + 'Quartz Compositor') wmtheme=$(/usr/libexec/PlistBuddy -c "Print AppleAquaColorVariant" ~/Library/Preferences/.GlobalPreferences.plist) if [ -z "$wmtheme" ] || [ "$wmtheme" == "1" ]; then @@ -1390,15 +1402,7 @@ getstyle () { # Current DE case "$XDG_CURRENT_DESKTOP" in "KDE"*) - if type -p kde5-config >/dev/null 2>&1; then - kde_config_dir=$(kde5-config --localprefix) - - elif type -p kde4-config >/dev/null 2>&1; then - kde_config_dir=$(kde4-config --localprefix) - - elif type -p kde-config >/dev/null 2>&1; then - kde_config_dir=$(kde-config --localprefix) - fi + kdeconfigdir if [ -f "${kde_config_dir}/share/config/kdeglobals" ]; then kde_config_file="${kde_config_dir}/share/config/kdeglobals" @@ -2552,6 +2556,23 @@ cache () { # }}} +# KDE Config directory {{{ + +kdeconfigdir () { + if type -p kde5-config >/dev/null 2>&1; then + kde_config_dir=$(kde5-config --localprefix) + + elif type -p kde4-config >/dev/null 2>&1; then + kde_config_dir=$(kde4-config --localprefix) + + elif type -p kde-config >/dev/null 2>&1; then + kde_config_dir=$(kde-config --localprefix) + fi +} + +# }}} + + # }}}