-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_wallpaper
executable file
·55 lines (42 loc) · 2.06 KB
/
get_wallpaper
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# This script is run when the application starts
# Its purpose is to obtain the current wallpaper as an absolute path, or file URI (e.g. file://a/b.jpg)
# This is needed by Variety at start to ensure History->Back works OK to revert back to the pre-Variety wallpaper.
desktop="$DESKTOP_SESSION"
# Gnome 3, Unity:
if [ "$desktop" == "ubuntu" ] || [ "$XDG_CURRENT_DESKTOP" == "Unity" ]; then
gsettings get org.gnome.desktop.background picture-uri
# XFCE
elif [ "$desktop" == "xubuntu" ] || [ "$XDG_CURRENT_DESKTOP" == "XFCE" ]; then
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image
# LXDE/PCManFM
elif [ "$XDG_CURRENT_DESKTOP" == "LXDE" ]; then
# The PCManFM config path varies by session name; Lubuntu is effectively a special case here
if [ "$desktop" == "Lubuntu" ]; then
desktop="lubuntu" # Curse this inconsistency in cases
fi
grep wallpaper=/ "$HOME/.config/pcmanfm/$desktop/desktop-items-0.conf" | sed -e 's/wallpaper=//g'
# LXQt/PCmanFM-qt
elif [ "$XDG_CURRENT_DESKTOP" == "LXQt" ]; then
grep wallpaper=/ ~/.config/pcmanfm-qt/lxqt/settings.conf | sed -e 's/wallpaper=//g'
# MATE
elif [ "$XDG_CURRENT_DESKTOP" == "MATE" ]; then
gsettings get org.mate.background picture-filename
# Cinnamon after 2.0
elif [ "$desktop" == "Cinnamon" ] || [ "$XDG_CURRENT_DESKTOP" == "X-Cinnamon" ]; then
gsettings get org.cinnamon.desktop.background picture-uri
# KDE Plasma 5
elif [ "$XDG_CURRENT_DESKTOP" == "KDE" ] && [ "$KDE_SESSION_VERSION" == "5" ]; then
grep 'Image=' ~/.config/plasma-org.kde.plasma.desktop-appletsrc | sed 's/Image=//'
# Trinity
elif [ "$XDG_CURRENT_DESKTOP" == "Trinity" ]; then
# The "1" refers to the virtual desktop number
dcop kdesktop KBackgroundIface currentWallpaper 1 2> /dev/null
# All above fails => fallback to the Gnome 3 way
else
gsettings get org.gnome.desktop.background picture-uri
fi
# Feh
# sed "s/\ /\n/g" ~/.fehbg | grep \'
# Gnome 2
# gconftool-2 --get /desktop/gnome/background/picture_filename