diff --git a/1.6.md b/1.6.md
index 35543e9f..42ce9443 100644
--- a/1.6.md
+++ b/1.6.md
@@ -30,6 +30,7 @@ appearing in the output.
allow us to speed up the script by caching info that won't change for a
long period of time like the CPU/GPU. \[1\]
- Fixed a locale issue when `LC_ALL` is unset on the user's system.
+- Change all usage of `$HOME/.config` to `$XDG_CONFIG_HOME` with a fallback to `$HOME/.config`.
\[1\] You can clear the cache with `--clean`.
@@ -55,6 +56,9 @@ the color white, it's now based on your foreground color.
- Functions now no longer print `Unknown` when they fail, they now don't appear at all.
+**Window Manager Theme**
+- Added new `WM Theme` function to print window manager themes.
+
**OS**
- [ CRUX ] Also print the CRUX version. **[@onodera-punpun](https://github.com/onodera-punpun)**
- [ Fedora ] Fixed a weird detection bug.
diff --git a/config/config b/config/config
index 6748ee8f..e79ff051 100644
--- a/config/config
+++ b/config/config
@@ -7,7 +7,6 @@
# Speed up script by not using unicode
export LC_ALL=C
export LANG=C
-export LANGUAGE=C
# Info Options {{{
@@ -25,8 +24,9 @@ printinfo () {
info "Packages" packages
info "Shell" shell
info "Resolution" resolution
- info "Desktop Environment" de
- info "Window Manager" wm
+ info "DE" de
+ info "WM" wm
+ info "WM Theme" wmtheme
info "Theme" theme
info "Icons" icons
info "CPU" cpu
@@ -394,7 +394,7 @@ config="on"
# Path to custom config file location
# --config path/to/config
-config_file="$HOME/.config/neofetch/config"
+config_file="${XDG_CONFIG_HOME:-${HOME}/.config}/neofetch/config"
# }}}
diff --git a/neofetch b/neofetch
index c6bebab3..82ab3d2e 100755
--- a/neofetch
+++ b/neofetch
@@ -22,8 +22,9 @@
# Created by Dylan Araps
# https://github.com/dylanaraps/
-version=${BASH_VERSION/.*}
+version="${BASH_VERSION/.*}"
SYS_LOCALE="${LANG:-C}"
+XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}"
# Speed up script by not using unicode
export LC_ALL=C
@@ -49,8 +50,9 @@ printinfo () {
info "Packages" packages
info "Shell" shell
info "Resolution" resolution
- info "Desktop Environment" de
- info "Window Manager" wm
+ info "DE" de
+ info "WM" wm
+ info "WM Theme" wmtheme
info "Theme" theme
info "Icons" icons
info "CPU" cpu
@@ -419,7 +421,7 @@ config="on"
# Path to custom config file location
# --config path/to/config
-config_file="$HOME/.config/neofetch/config"
+config_file="${XDG_CONFIG_HOME:-${HOME}/.config}/neofetch/config"
# }}}
@@ -807,6 +809,118 @@ getwm () {
# }}}
+# Window Manager Theme {{{
+
+getwmtheme () {
+ [ -z "$wm" ] && getwm
+
+ case "$wm" in
+ 'BudgieWM') wmtheme="$(gsettings get org.gnome.desktop.wm.preferences theme)" ;;
+ 'E16') wmtheme="$(awk -F"= " '/theme.name/ {print $2}' "$HOME/.e16/e_config--0.0.cfg")";;
+ 'Sawfish') wmtheme="$(awk -F ")" '/\(quote default-frame-style/ {print $2}' "$HOME/.sawfish/custom")" ;;
+
+ 'Cinnamon' | 'Muffin' | 'Mutter (Muffin)')
+ detheme="$(gsettings get org.cinnamon.theme name)"
+ wmtheme="$(gsettings get org.cinnamon.desktop.wm.preferences theme)"
+ wmtheme="$detheme (${wmtheme})"
+ ;;
+
+ 'Compiz' | 'Mutter'* | 'GNOME Shell' | 'Gala')
+ if type -p gsettings >/dev/null 2>&1; then
+ wmtheme="$(gsettings get org.gnome.desktop.wm.preferences theme)"
+
+ elif type -p gconftool-2 >/dev/null 2>&1; then
+ wmtheme="$(gconftool-2 -g /apps/metacity/general/theme)"
+ fi
+ ;;
+
+ 'Metacity'*)
+ if [ "$de" == "Deepin" ]; then
+ wmtheme="$(gsettings get com.deepin.wrap.gnome.desktop.wm.preferences theme 2>/dev/null)"
+
+ else
+ wmtheme="$(gconftool-2 -g /apps/metacity/general/theme 2>/dev/null)"
+ fi
+ ;;
+
+ 'E17' | 'Enlightenment')
+ if type -p eet >/dev/null 2>&1; then
+ wmtheme="$(eet -d $HOME/.e/e/config/standard/e.cfg config | awk '/value \"file\" string.*.edj/ {print $4}')"
+ wmtheme=${wmtheme##*/}
+ wmtheme=${wmtheme%.*}
+ fi
+ ;;
+
+ 'Fluxbox')
+ [ -f $HOME/.fluxbox/init ] && \
+ wmtheme="$(awk -F "/" '/styleFile/ {print $NF}' "$HOME/.fluxbox/init")"
+ ;;
+
+ 'IceWM'*)
+ [ -f $HOME/.icewm/theme ] && \
+ wmtheme="$(awk -F "[\",/]" '!/#/ {print $2}' "$HOME/.icewm/theme")"
+ ;;
+
+ 'Openbox')
+ if [ "$de" == "LXDE" ] && [ -f "${HOME}/.config/openbox/lxde-rc.xml" ]; then
+ ob_file="lxde-rc"
+
+ elif [ -f "${HOME}/.config/openbox/rc.xml" ]; then
+ ob_file="rc"
+ fi
+
+ wmtheme="$(awk -F "[<,>]" '//dev/null)"
+ wmtheme="${wmtheme##*\\}"
+ wmtheme="${wmtheme%.*}"
+ wmtheme="${wmtheme^}"
+ ;;
+
+ esac
+
+ wmtheme="${wmtheme//\'}"
+ [ "$version" -ge 4 ] && wmtheme=${wmtheme^}
+}
+
+# }}}
+
# CPU {{{
getcpu () {
@@ -1282,8 +1396,6 @@ getstyle () {
gconf="gtk_theme"
xfconf="ThemeName"
kde="widgetStyle"
- path="/proc/registry/HKEY_CURRENT_USER/Software/Microsoft"
- path+="/Windows/CurrentVersion/Themes/CurrentTheme"
;;
icons)
@@ -1307,15 +1419,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"
@@ -1377,8 +1481,8 @@ getstyle () {
# Check for gtk3 theme
if [ -z "$gtk3theme" ]; then
- if [ -f "$HOME/.config/gtk-3.0/settings.ini" ]; then
- gtk3theme=$(grep "^[^#]*$name" "$HOME/.config/gtk-3.0/settings.ini")
+ if [ -f "$XDG_CONFIG_HOME/gtk-3.0/settings.ini" ]; then
+ gtk3theme=$(grep "^[^#]*$name" "$XDG_CONFIG_HOME/gtk-3.0/settings.ini")
elif type -p gsettings >/dev/null 2>&1; then
gtk3theme="$(gsettings get org.gnome.desktop.interface $gsettings)"
@@ -1430,17 +1534,6 @@ getstyle () {
theme=${theme/ '[GTK3]'}
theme=${theme/ '[GTK2/3]'}
fi
- else
- case "$os" in
- "Windows")
- [ -z "$path" ] && return
- theme="$(head -n1 "$path" 2>/dev/null)"
- theme="${theme##*\\}"
- theme="${theme%.*}"
- theme="${theme^}"
- ;;
-
- esac
fi
}
@@ -1759,7 +1852,7 @@ getwallpaper () {
img="$(awk -F\' '/feh/ {printf $2}' "$HOME/.fehbg")"
elif type -p nitrogen >/dev/null 2>&1; then
- img="$(awk -F'=' '/file/ {printf $2;exit;}' "$HOME/.config/nitrogen/bg-saved.cfg")"
+ img="$(awk -F'=' '/file/ {printf $2;exit;}' "$XDG_CONFIG_HOME/nitrogen/bg-saved.cfg")"
elif type -p gsettings >/dev/null 2>&1; then
case "$XDG_CURRENT_DESKTOP" in
@@ -2408,26 +2501,26 @@ getconfig () {
source "$config_file"
return
fi
- mkdir -p "$HOME/.config/neofetch/"
+ mkdir -p "$XDG_CONFIG_HOME/neofetch/"
- # Check $HOME/.config/neofetch and create the
+ # Check $XDG_CONFIG_HOME/neofetch and create the
# dir/files if they don't exist.
- if [ -f "$HOME/.config/neofetch/config" ]; then
- source "$HOME/.config/neofetch/config"
+ if [ -f "$XDG_CONFIG_HOME/neofetch/config" ]; then
+ source "$XDG_CONFIG_HOME/neofetch/config"
elif [ -f "/usr/share/neofetch/config" ]; then
- cp "/usr/share/neofetch/config" "$HOME/.config/neofetch"
- source "$HOME/.config/neofetch/config"
+ cp "/usr/share/neofetch/config" "$XDG_CONFIG_HOME/neofetch"
+ source "$XDG_CONFIG_HOME/neofetch/config"
elif [ -f "/usr/local/share/neofetch/config" ]; then
- cp "/usr/local/share/neofetch/config" "$HOME/.config/neofetch"
- source "$HOME/.config/neofetch/config"
+ cp "/usr/local/share/neofetch/config" "$XDG_CONFIG_HOME/neofetch"
+ source "$XDG_CONFIG_HOME/neofetch/config"
else
getscriptdir
- cp "$script_dir/config/config" "$HOME/.config/neofetch"
- source "$HOME/.config/neofetch/config"
+ cp "$script_dir/config/config" "$XDG_CONFIG_HOME/neofetch"
+ source "$XDG_CONFIG_HOME/neofetch/config"
fi
}
@@ -2469,6 +2562,26 @@ cache () {
# }}}
+# KDE Config directory {{{
+
+kdeconfigdir () {
+ if [ -n "$KDE_CONFIG_DIR" ]; then
+ kde_config_dir="$KDE_CONFIG_DIR"
+
+ elif 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
+}
+
+# }}}
+
+
# }}}