Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
default_list="file:///home/user/wp-live-ws.png file:///home/user/wp-persistent-ws.png file:///home/user/wp-live-gw.png file:///home/user/wp-persistent-gw.png"
current_wp=$(cat /home/user/.config/plasma-org.kde.plasma.desktop-appletsrc | grep "Image=" | sed 's/Image=//' )
change_wp() {
if [ -f /usr/share/anon-ws-base-files/workstation ]; then
if cat /proc/cmdline | grep "boot=live"; then
#set wallpaper for workstation live
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file:///home/user/wp-live-ws.png")}'
else
#set wallpaper for workstation persistent
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file:///home/user/wp-persistent-ws.png")}'
fi
elif [ -f /usr/share/anon-gw-base-files/gateway ]; then
if cat /proc/cmdline | grep "boot=live"; then
#set wallpaper for gateway live
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file:///home/user/wp-live-gw.png")}'
else
#set wallpaper for gateway persistent
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file:///home/user/wp-persistent-gw.png")}'
fi
fi
}
#on a new whonix install there is no default wallpaper $current_wp, therefore set one when this variable is empty
if [ -z $current_wp ]; then
echo "No initial wallpaper was set. Setting the default one. "
change_wp
else
#if the wallpaper is set to something else then we assume the user set a custom one. if this is the case skip changing the wp
if [ -z "$(echo $default_list | grep $current_wp )" ]; then
echo "The current wallpaper is not in the default list. Changing wp was skipped. " && exit 0
else
echo "Setting wp. "
change_wp
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment