Saturday, February 23, 2008

a simple but amazingly useful contribution

today i wanted to set up a key shortcut so i did what has become natural for me: alt-f2 (to pull up the krunner window) and type "shortcut".

nothing.

ok, so i try again: this time i try "keyboard". keyboard layout, keyboard accessibility preferences, system wide key mappings ... no keyboard shortcuts. damn.

how about "keys"? kde3's input shortcuts, kde4's keyboard shortcuts and accessibility. yes! there is it! but .. no. it's the kde3 kcm. uh-oh. why did i have to guess three times? because KServiceTypeTrader's syntax doesn't do what i want. so i've fixed that (commit pending approval of syntax addition on kde-core-devel) and now typing "shortcuts", "short", "keys", etc returns the shortcuts control panel but ... "keyboard" still doesn't work! why?

because "keyboard" does not appear in the keywords for that control panel. doh!

this problem does not just affect krunner, but also system settings (and kcontrol when/if someone finishes the kde4 port of it), search indexers (e.g. strigi, beagle, etc).

but despair not! an industrious soul or two could save the day by going through the control panel .desktop files and audit the keywords. this is something anyone who can read and write english (that's you!) with a text editor (also you!) could do. interested? the read on to find out how!

in $PREFIX/share/kde4/services/ there are .desktop files that represent control panels. i've put a tarball of them here (it's 255k in size), though you could also find them on your local kde4 install with `grep kcmshell4 *desktop` in $PREFIX/share/kde4/services/. if you grab the tarball, uncompress it somewhere locally.

i'd recommend making a copy of the original set for each diff'ing later on.

then open a .desktop file and do the following steps:


  1. find the Exec= line

  2. run the command (e.g. `kcmshell4 xserver`) and take a look at what the control panel actually provides

  3. go back to the .desktop file and find the Keywords= entry and add to, remove from or modify the list of phrases. the list is separated by commas and entries can have more than one word.

  4. save your changes



repeat until you're tired, bored or happy that you've done your part =)

now generate a diff between the old and the new version (this is why i suggested to make a copy of the directory above). you can do this with the `diff` command line application, e.g.: `diff -u kcms.orig kcms > kcm_keyword_changes.diff` (without the backticks). this will leave you with a kcm_keyword_changes.diff file that you can then email me. i'll apply your changes from there to svn and searching for control panels will become that much more accurate and easier.

we have a general policy of including the contributors name in the commit log message when merging contributions, so this is your chance to get your name in KDE's hall of fame commit logs. ;)

15 comments:

Anonymous said...

Seems like an ideal candidate for automation to me.

dlr.pe said...

I am looking through these, and no - it's not a candidate for automation. Each .desktop is associated with a different function; simply adding "keyboard" to each one is not appropriate.

I think I can handle this, but I have a (probably) simple question - are the keywords case-sensitive? I looked through several of the .desktop files, and it seems that most of the (English) keywords have an initial capital. However, just enough of them are not capitalized to make me unsure.

- Dave.

Big said...

Well this doesn't work on OS X, so can't help you. No doubt someone else will get it done.

- illogic-al

freality said...

Can desktop files share keywords? or will that screw up the matching?

Also, can I expect a quick tutorial on what to do with these after I'm done? or a link?

And thanks for bringing light to this task. I was browsing the buglist today after reading the 5 a day initiative, and I just didn't see a thing I felt qualified to do.

Aaron J. Seigo said...

@dlr.pe: no, they are not case sensitive

@freality: the files can certainly share keywords. that way when you type "keyboard" you get all the keyboard related items. perfect!

as for what to do when you are done, follow the part in this blog entry about doing a diff and emailing me the results =)

if you want to see the results locally, you can apply the resulting diff to your local $PREFIX/share/kde4/services/

bryx@gmx.net said...

I think it IS a subject of automation...
Why not scanning the localization files of a program and add the words from there to the strigi db ?
Sure this will result in some not useful entries but I think building a "blacklist" for these common words like "Ok" or "cancel" based on count of appearance in different modules/programs should also be not that difficult.
My vision would be:
I install a program, strigi scans the localization files associated with that program and without any developer/user interaction desktop search will find that program.

Dentharg said...

I was always wandering why-oh-why Linux (meaning KDE) does not use Win keys by default for shortcuts; at least to ease pain of Windows-2-Linux migration.

It could mimic Win+R (same as Alt-F2), Win+E would startup Konqueror in home dir. Such keyboard are a vastly majority on the market and this key is specifically designed for such shortcuts. And it will not interfere with other shortcuts and is always one key more for shortcuts :)

kwilliam said...

I am on the job! This is not only something I can be passionate about (because I've been pissed off that System Settings doesn't have all the nice keywords from KControl) and it's something I can do without fear that it will interfear with my studies.

kwilliam said...

Quick question: does system settings use full keyword search? E.g., if I add the keyword "mouse gestures" is it redundant to include the keywords "mouse", "gesture", and "gestures" since they are all part of the original string? (And would relying on "keys" to implicity also match "key" cause translation problems?)

Blue Lightning said...

Consider also adding the word "hotkeys" (or maybe just "hotkey") if appropriate, and you can close 113132. (Disclaimer - I reported it :)

Miquel said...

>so i did what has >become natural for >me: alt-f2 (to pull >up the krunner

Speaking about shortcuts and krunner. the alt-f2 function had a massive upgrade for kde4. Heck, krunner is actually much more than the old alt-f2 minicli.

So my question is, being so much more usefull, why not asign it a single click shortcut, like just 'F2'?. I think it deserves a first-level shortcut, and pressing alt-f2 is not always easy/comfortable.

Keep up the good work!

tobami said...

Hey! why are you actually wasting your time with such trivial things as .desktop files? The only true graphics ninja has arrived at your place and you two are not doing some Voodoo magic, yet? I still can't feel the shock waves in the computer world continuum! :-D

Anonymous said...

> I think it deserves a first-level shortcut, and pressing alt-f2 is not always easy/comfortable.

I can add that it probably even deserves a button on the toolbar to improve its discoverability. Many users will simply not find the shortcut and will just ignore 'Run command' menu item because their experience from all other systems. Think of 'Deskbar applet' in ubuntu.

Anonymous said...

Sorry for the dumb question: "Do you have to be running KDE 4 for this to work?"

I am running 3.5.8 but would be willing to help with this

-zeker

Aaron J. Seigo said...

@zecker: not at all, this just requires a text editor and a bit of time.