DCOP and Pretty Eye Candy
After a little discussion on #kde about a programme that no-one could remember the name of, but which produced a cool "slowly changing the background colour" effect, I decided to have a go at creating my own version with Perl and DCOP. Turned out to be pretty easy, with the hardest bit being working out how to calculate what colour to use next.
So, here it is: http://users.ox.ac.uk/~chri1802/stuff/chbg.pl.
The actual DCOP call is just one easy line, and most of the code is twiddling the RGB colour value. Doing it with HSV would almost certainly be cleaner - I'll look into it sometime.
Lauri pointed out that it's a nice as an example of general DCOP scripting, so I wrote it up and put it in the User Guide. The prose isn't great, and it could do with some screenshots etc, but comments, suggestions and improvements are welcome.
And on a similar note, does anyone have any other nice uses of the KDE command line tools? Between kreadconfig, kdialog, dcop, kstart and a little scripting glue, we've got a powerful framework that could do with more extensive documentation and promotion. Rich Moore has already written some info on kstart and ksystraycmd, but any more ideas would be gratefully received.
2 Comments:
My nice use of a KDE command line tool
kfmclient copy foo.ttf fonts:/
for installing a font :-)
For command line utilities, in which the only interaction is typing username/password (like dialers, mailfetchers) you can save your password in Kwallet, and use dcop to pipe your password to the utility. Saves you the hassle of typing it each time, and, still, passwords are not saved in cleantext as they would if you just put them in the shell script.
I used this trick with a mailfetcher (not fetchmail), and put the resulting shellscript in the prefetch command of kmail. worked like a charm :)
Post a Comment
<< Home