From b5757417d57043602e1dbc800b889234c190e0ef Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 28 Dec 2016 11:59:10 +1100 Subject: [PATCH] Wallpaper: Decode gsettings file paths, closes #573 --- neofetch | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index ee92cf6d..f56771d9 100755 --- a/neofetch +++ b/neofetch @@ -2020,9 +2020,14 @@ get_wallpaper() { (( "$de_run" != 1 )) && get_de case "$de" in - "Cinnamon"*) image="$(gsettings get org.cinnamon.desktop.background picture-uri)" ;; - "MATE"*) image="$(gsettings get org.mate.background picture-filename)" ;; - "XFCE"*) image="$(xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image)" ;; + "MATE"*) image="$(gsettings get org.mate.background picture-filename)" ;; + "XFCE"*) image="$(xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image)" ;; + + "Cinnamon"*) + image="$(gsettings get org.cinnamon.desktop.background picture-uri)" + image="$(decode_url "$image")" + ;; + *) if type -p feh >/dev/null && [[ -f "${HOME}/.fehbg" ]]; then image="$(awk -F\' '/feh/ {printf $2}' "${HOME}/.fehbg")" @@ -2031,7 +2036,8 @@ get_wallpaper() { image="$(awk -F'=' '/file/ {printf $2;exit;}' "${XDG_CONFIG_HOME}/nitrogen/bg-saved.cfg")" else - image="$(gsettings get org.gnome.desktop.background picture-uri)" + image="$(gsettings get org.gnome.dimage=esktop.background picture-uri)" + image="$(decode_url "$image")" fi ;; esac @@ -2039,7 +2045,6 @@ get_wallpaper() { # Strip un-needed info from the path. image="${image/'file://'}" image="$(trim_quotes "$image")" - image="${image//\%20/ }" ;; "Mac OS X") @@ -3109,6 +3114,11 @@ get_process_name() { printf "%s" "$name" } +decode_url() { + decode="${1//+/ }" + printf "%b" "${decode//%/\\x}" +} + # FINISH UP usage() { printf "%s" "\