Skip to content

Instantly share code, notes, and snippets.

@marguerite
Created November 8, 2020 07:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marguerite/34d687cfaa88888f17bc0777a1c40509 to your computer and use it in GitHub Desktop.
Save marguerite/34d687cfaa88888f17bc0777a1c40509 to your computer and use it in GitHub Desktop.
Plasma 5 Desktop Scripting: Change Wallpaper in InteractiveConsole
for (i in activities()) {
activityID = activities()[i];
desktops = desktopsForActivity(activityID)
for (j in desktops) {
desktop = desktops[j];
desktop.wallpaperPlugin = "org.kde.image";
desktop.wallpaperMode = "Scaled and Cropped";
desktop.currentConfigGroup = new Array("Wallpaper", "org.kde.image", "General");
desktop.writeConfig("Image", "file:///home/zhou/Pictures/Bing/AlpineLarches_ZH-CN10557456981_1920x1200.jpg");
}
}
@marguerite
Copy link
Author

the latest plasma5 is activity based, so the old "desktop()" function will get nothing. you should get activities first to get the available desktops. tested on plasma 5.20.2
reference: https://userbase.kde.org/KDE_System_Administration/PlasmaTwoDesktopScripting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment