KDE 4.2 - Changes in KKeySequenceWidget

Multikey shortcuts in kde 4.1 where officially supported. But the implementation wasn't what most of us expected. KKeySequenceWidget - responsibly for capturing key sequence from the user - had some annoying bugs.

picture of the kkeysequence widget KKeySequenceWidget is this small widget most of you will know. With kde 4.1 it had some shortcomings. The developer / code was able to use shortcuts like "ctrl-r, ctrl-t" or "ctrl-r, shift-t. The user was unable to assign these because KKeySequenceWidget couldn't handle them.

When capturing shortcuts it only allowed pressing one or more modifiers and then sequentially some keys. If one modifier was released the capturing stopped immediately. A modifier is one of shift, meta, alt or ctrl. Even if you had to hold down the modifier(s) all the time during the capturing, the resulting shortcut only had the modifier(s) on the first key. After for example pressing ctrl-r, ctrl-s while capturing, the resulting shortcut was ctrl-r, s. So you had to release ctrl before pressing s. It was not possible to switch modifier during the capturing.

With kde 4.2 the capturing goes on as long as a modifier is pressed. If the last modifier is released a timer starts. if the user presses a key before the timer ends the key is added to the sequence and the timer restarts. If the user presses a modifier before the timer ends the timer is stopped again and the capturing goes on.

With that scheme it's possible to record the weirdest shortcuts. Go ahead and assign "ctrl-r, meta-s, k, alt-s".

I would like to have some feedback on the usability and intuitiveness of capturing key sequences. Currently the timer isn't visualized. I think it should. Anyone else an opinion?

The maximum number of keys is currently hard coded as 4. With KKeySequenceWidget::setMultiKeyShortcutsAllowed() it's possible to only allow one key shortcuts. This is needed for global shortcuts because it's not possible to have multikey global shortcuts currently.

But before you get to creative with your shortcuts keep the ambiguity problem in mind. I will talk about this problem in one of my next posts. But in short. It's not possible to have both "ctrl-a" and "ctrl-a, shift-s" at the same time. KShortcutsEditor knows that and will warn you.

Mike

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Use "clear" button?

I think visualizing the timer is a good idea. Perhaps the clear button (that button with the "x", I don't know the proper name) could be grayed out while assigning the shortcut, and you could display the timer there. I would use something abstract rather than numbers, perhaps a circle with pie-shaped slices disappearing one after another, and when all the pieces are gone the timer is up. I agree that multiple shortcuts would be really useful. I also would really like shortcuts that include mouse buttons (alongside keyboard modifiers).

Oh, *thank you* for this. I

Oh, *thank you* for this. I was a huge fan of multi-key shortcuts in KDE 3 and was seriously missing them. :) My favorite trick: put all major desktop-related shortcuts after a Meta+D, put all the window-related shortcuts after a Meta+W. For instance, Meta+W, Meta+Up to maximise. Meta+D, Meta+Right to send window to the next desktop. Extremely convenient! Will this work in KDE 4.2, or do those count as global shortcuts? When will multi-key global shortcuts work (pretty please with sugar on top)? Thanks again Mike. :)

Oh, *thank you* for this.

I'm sorry to say that but those shortcuts are global shortcuts. I have not yet found the exact reasoning why multikey global shortcuts are forbidden, but I want to take a look at that kde 4.3.

feedback

How about a "recording light" that comes on while capturing, a blue LED or something like that.

Great! But it still doesn't work for me in input actions kcm

Thank you for doing this, it's really more usable and easier to use than before in 4.1. But note that it still doesn't work in input actions kcm. I can assign multikey shortcut (e.g. ctrl+q, shift+b), but when I press apply it automatically switches to only first one (ctrl+q) and triggers on it.

Also, in 3.5 there was a nice popup which would appear when using multikey shortcuts, for example:


______________________
Alt+Space,... |
Maximize Window X |
Minimize Window Y |
Hide Border C |
[...] |
______________________|

Great! But it still doesn't work for me in input actions kcm.

The input actions kcm's shortcuts are global shortcuts. That means they can only be one key shortcuts. With Lubos resurrecting the kde 3.5 version of that kcm i'm not sure which version you use. With kde 4.2 my version for input actions will be delivered. You can't record multikey shortcuts there.

I'm thought about something like that popup for kde 4.2. The problem is in kde 3.x we did the complete shortcut handling in kde code. With qt 4.0 that logic was incorporated into qt. kde4 now uses the qt code. But now we do not have all information needed to supply that popup. And my communication with Trolltech/Nokia regarding bugs/features in that code leads me to the conclusion that situation won't get better anytime soon.

Meta

"Meta" is a pain in the ass. I've looked it up, but I forgot again what it was... the right Alt key, wasn't it? Anyways, there is no key on my keyboard that says "Meta", and when any of my not-so-technically-inclined friends reads "Meta-[whatever]" in the shortcuts dialog, I bet my morning muesli that neither of them knows what's meant by that.

Could it be somehow possible to replace Meta by whatever key it is actually assigned to? Or at least show some inline help in the shortcuts dialog that tells me what Meta is all about? Imho, that would be usability enhancement #1.

Meta

The translation is provided by Qt. That's where meta comes from. And i don't know enough about the underlying X-Code to say if it is possible to improve it.

Double key presses

Hey what do you think... will it be possible to assign a double key press? p.e. at work i'am musing windows xp with googles' desktop search. i just need to press ctrl twice to get the search bar... i really would like to see this on kde to open krunner.

Sweet

Awesome! Now I won't have to mentally switch between emacs and kde shortcut bindings.

Multiple global shortcuts?

Will it also be possible to assign multiple global shortcuts for an action in KDE4.2? In KDE3.5 it was possible to assign two, which is very useful for e.g. assigning both media keys of a wireless remote keyboard and regular keys on the normal wired keyboard to amarok actions.

Multiple global shortcuts?

Not yet. But it would be a rather trivial fix.

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.