Finding shortcut

Michael Jansen kde at
Sun Jan 31 18:45:14 GMT 2010

On Sunday 31 January 2010 19:06:37 Aaron J. Seigo wrote:
> On January 29, 2010, John Tapsell wrote:
> > Hi all,
> > 
> >   Programmatically, I want to find out what the shortcut is for the
> > 
> > global "Kill Window" shortcut (usually assigned to ctrl+alt+esc).  How
> > do I do this?
> > 
> >   It looks like I need a new function added to KGlobalShortcut to
> > 
> > return a QKeySequence for a given action name.  Does this sound
> > correct?

Yes and no.  Depends on your use case. I prefer to hear about the thing you want to achieve instead 
of what you think the solution is.

The answer to your question technically could be:

1. Parse kglobalshortcutrc

2. Use kglobalaccels dbus interface. It supports your use case but that is not that comfortable.

3. Use a trick with KAction i won't elaborate until we know it is really needed.

4. Do what you suggested. But until we know it is a valid use case i don't think adding such a 
function to our api is the thing to do.

So please elaborate what you are trying to do and we see what the correct way is.

> KGlobalShortcutInfo already provides this. however, KGlobalAccel doesn't
> seem to offer any "query by name" methods. it only allows (from what i can
> see?) getting the shortcut info for a given accel sequence or listing
> known entries by name ... so it does seem than KGlobalAccel is missing
> something like a KGlobalShortcutInfo getGlobalShorcutByName(const QString
> &module, const QString &name)
> (and no, i don't know why it uses "get" in the method names :)

You seem to have a lot of fun to bash everything global shortcuts related. Why not make a blog post 
titled "10 things i hate about kde's global shortcut implementation" and reference that whenever you 
have the urge to once again show your disapproval?

The part about you picking apart it's api is the one thing i really want to see because i will admit 
openly that i do not have much experience designing apis generally and kde specific. So i always look 
for valuable input (No sarcasm) to learn.


More information about the kde-core-devel mailing list