Communicating with desktop

December 4, 2009
One of the major things I like and admire in KDE is DCOP. With DCOP, you can query, change or list desktop parts with a simple command and a few parameters. Or shortly, you can " inspect" your environment.

I'm not proficient with DCOP, nor had a chance to use it more than experimenting with the given examples, but knowing you can control your environment in the few commands is really powerful concept. Or maybe, controlling it via some language, like Apple did with AppleScript, if we are going to be more serious.

Last few days, I was playing with similar concept in EDE. Of course, for the start, it gives some rudimentary options and we will see how it will expand itself in the future.

I named it " ede-scriptbus"; the name left from my previous attempt to write some simple scripting suport for D-Bus things and, as expected, I ended up with different thing :)

ede-scriptbus comes with embedded Scheme language, via TinyScheme. Now, I hear someone is screaming Lua name, but I already had some code written with TinyScheme, plus I can easily hack interpreter if I need to adjust it. Remember, ede-scriptbus is still in prototype phase.

Now, what can be done with it? For now, it is capable to query application specific settings and XSETTINGS registry (yesterday evoke got changed to export XSETTINGS values via D-Bus). Here is sample image:

Basically, you query desired items, much like you do query on some database. I had to make distinction between XSETTINGS and application settings queries because keys have different format, but this can be easilly wrapped, providing unique query interface.

Adding ability to change existing values or set new key/value pairs should not be hard either and this is next in my TODO list. But, there is one issue I'm still contemplating: documentation of configuration values. Huh boy, this sounds scary :)

One of the greates irony of configuration files (meaning about those INI style files desktops are using extensively) is how they are readable and can be easily changed. Yes, you can easily view the content, but how much stuff you can understaind from it?

Here is excerpt of ede-desktop config file:

You already understaind how " wallpaper" key has full path to background image, but what " color" stands for? Background color? Yes, but what values it can have, or what values should be in " wallpaper_mode" when you want to stretch background image?

This problem is not only EDE related; look my qtrc (Qt configuration file) for example:

XIMInputStyle=On The Spot
The same problem here. GConf has ability to document these things, but GConf is story for itself.

Actually, the idea is that the person who changes the key/values via ede-scriptbus, can query their description too, like:
> (doc "Net/IconThemeName")

"(type string)"
"The name for currently used icon theme. Changing the name to different
icon theme will immediately be applied on all EDE and Gtk+ applications."
Would be neat, but, is it possible to do it?

First things first, I need to complete this tool and we will see the next steps :)