Monday, June 30, 2008

Converting any window into plasmoid

Take a look at the following screenshots:

Besides familiar Clock and Calculator you can see several new plasmoids here:
  • Konsole
  • MPlayer
  • Speedcrunch calculator
  • Step physical simulator
No, I have not rewrote all that apps as plasmoids. Instead I've wrote an applet that allows you to convert any running application into plasmoid. Currently it works using XEmbed protocol and therefore have lots of problems:
  • You can't rotate these plasmoids and they don't work correctly with ZUI (however the latter can still be improved a bit)
  • Z-order of plasmoids is not respected (i.e. in case you have several overlapping plasmoids)
  • Switching between Desktop and Dashboard is not very smooth: embedded applications are only repainted after several-seconds delay
All these problems can be fixed by using Composite extension (and input redirection) instead of XEmbed but this will probably require some cooperation with KWin and will only work when Composite is enabled.

There is another problem: currently you have to manually re-configure all window-embedding plasmoids after restarting plasma. For KDE applications this can probably be partly fixed by using KDE session management, for other applications one can allow the user to setup command line of the application to start.

Despite all current limitation, I think this approach still has its own use-cases, for example when you want quick access to some of your applications from Dashboard (for example Konsole) or if you want something not-yet-available as plasmoid on your desktop (for example video player, advanced calculator, web-browser with your webmail, a game from kdegames, googleearth, ...).

If you still want to try it, the code is available in playground/base/plasma/applets/embed-win.