Wallpaper plugin Slideshow should have the selected wallpaper image up to date in DBus API and other places
This patch assumes that the plugin configuration that is exposed as a QQmlPropertyMap
is actually a KConfigPropertyMap
(which it is) and forces it to sync to the file system.
As discussed in the bug report, a few concerns were raised:
- Syncing to disk for every wallpaper change can become expensive if the timer is very short. This was addressed by adding a simple rate limiter with a target average frequency of once a minute and a small burst budget - which is the bulk of this commit (I promised that it'll be a dozen LoC, and it is that but only if you count just "interesting" lines). If this is a useful feature, maybe it is worth adding it to KConfig.
- I'm not really interesting in syncing to disk - I just want the configuration changes to be propagated to what the DBUS call
org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.wallpaper
does and what Plasma shell scripting exposes throughDesktop.readConfig()
. I did not find a way to do it other than callingKConfigPropertyMap::writeConfig()
- Upcasting to
KConfigPropertyMap
is a really bad use of API. I would have liked to avoid this but I didn't find a more accessible API.
Any comments will be appreciated!
Edited by Oded Arbel