Mike's blog

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

Global Shortcut Drama Part II

My last two posts about global shortcuts got some comments i want to address now.

The Global Shortcut Drama

Whenever it comes to a discussion about the kde4 global shortcuts framework things heat up. Somehow people get really agitated if they learn how it works. Why? I don't know. It's a framework like any other. It has its ups, it has its downs. So lets have look where the problems are.

My little shortcut rant.

The reason i work on global and local shortcuts is because i care about them. I use heavily adapted desktop setups both under linux and windows. And that for years. Global shortcuts are an important part of these setups. Having to use the mouse makes me itchy.

Over this i time developed a global shortcuts setup that works for both on windows and linux. I tend to get angry if one of them doesn't work. Using them for more than five years makes me trying to use them unconsciously even if i know they don't work. Which frustrates me.

KMenuEdit - Support Application Shortcuts again

Just a short note that i commited a change to kdebase reenabling shortcut support in kmenuedit. It's now possible again to assign a global shortcut to an application in kmenuedit. It was possible for some time in kshortcuts but it looks like no one noticed.

Please tell me if you have problem with that feature.

The gui side in khotkeys is not yet finished but i'm working on it. If someone would like to help polish that contact me.

Mike

KDE4 And Application Shortcut Conflicts

When working with shortcuts you sooner or later encounter the problem of having action shortcut conflicts. Action shortcuts conflict if they are active in the same context and are either identical or one is part of the other (ambiguous).

Conflicting shortcuts in a kde4 application trigger some very frustrating behaviour: None. Nothing happens. No action is triggered. QShortcutEvents has a property to check if an event is ambiguous. QAction::event() checks if it is set and then silently drops the event. No signal is emitted.

Current State

There are three sources for conflicting shortcuts in KDE applications: shortcuts, standard shortcuts (KStandardAction and KStandardShortcuts) and global shortcuts. Global shortcuts are out of scope for this post.

Introduction to "planet kde"

My name is Michael Jansen. I'm 35 years old and a freelance config manager/developer from germany.

You can find my homepage at http://michael-jansen.biz . Only posts related to kde will be syndicated here.

I started contributing to kde in January 2008. That's pretty lame because i wanted to do that for some years. Developing is some kind of hobby for me since my real life jobs started to be more configuration management related.

Firefox Extensions

This is my list of must have Firefox extensions. These are the extensions i can't live without. I put them here for myself so i'm able to setup new firefox installations properly without great hassle.

This is just my list of useful extensions. There are many more out there.

build-tool

A week ago i started hacking on a python based kdesvn-build substitution. I did that for two reasons:

  1. I wanted to use git locally.
  2. I wanted to have an interactive tool, that does what kdesvn-build does.

Today i proudly present build-tool. It's not nearly feature complete but it does it's job. And i would like to get some feedback. Keep in mind that it's alpha quality. Noone else but me used it until now. So expect some failures.

Still alive

Just a short test of kblogger. I neglected this blog for a long time but having a new contract and hacking on kde combined with the good weather here left me no spare time .
Syndicate content