Design-by-blog, the brave new future! Well, we've also talked at length about it on IRC and on mailing lists, too .. so we're not quite in danger of ending up designing KDE by SMS messages yet ;)
Anyways ... Michael suggests the idea of application contexts for shortcuts, and that would be absolutely perfect for Plasma. As software becomes more flexible, more user-maleable (which is different than configurable), I think more and more of our software will end up having to think of things in terms of "contexts".
Mike ran through how Plasma, in the simple case, works right now:
"So let's see what is needed for plasma to work correctly. If an applet is added to an containment register the global shortcut. If you have no id to use create one. QUuid is very helpful in that regard as demonstrated by khotkeys. Associate the id with your applet. Optionally write the current set shortcut to disk after calling setGlobalShortcut() with the id. The shortcut you want is probably not the shortcut you get if the user configured it with the global shortcuts kcm. A choice you currently ignore and change back to whatever you have stored in your configuration."
This isn't quite how it works right now, though. Here's what we do:
- Each widget/applet has a unique ID
- If a shortcut is associated with a widget, we load it from the appletsrc file
- That shortcut gets registered, and right now we just force it (related to current shortcomings that contexts should fix for us)
- If the user changes the configuration, the shortcut action is told about this by the shortcuts kded module
- That shortcut gets written out to the appletsrc for usage in the future
- The shortcut is unregistered (via forgetGlobalShortcut()) when the widget goes away, which can happen when the user removes the widget, swaps layouts or just quits plasma (all three behaviours are quite different)
This isn't perfect, but contexts should resolve our remaining issues nicely and Plasma could then play even nicer with the rest of the desktop session. The remaining question will be when to call forgetGlobalShortcut, and I think the answer is that with contexts in place we'd be able to limit that to widget removal or widget layout exportation.
And yes, this has got to be one my least interesting blog entries in a while. =) Now all of you who read this know what kind of fun and crazy life I lead on the mailing lists. ;)