CDrummond / cantata

Qt5 Graphical MPD Client
GNU General Public License v3.0
1.04k stars 184 forks source link

Shortcut editor gets keys wrong #695

Closed rrthomas closed 9 years ago

rrthomas commented 9 years ago

When I press my CapsLock key, which is mapped as a Ctrl key, the shortcuts editor thinks I want "CapsLock" as a shortcut. It should detect the keycode of the pressed key, surely, not the actual key? (When I use the CapsLock key as part of a Ctrl+Foo combination in Cantata, it is correctly recognised, just as in every other program.)

CDrummond commented 9 years ago

The code for this was taken from quassel irc. I've updated the code. Any improvement?

rrthomas commented 9 years ago

Rebuilt with current master HEAD, exactly the same result.

CDrummond commented 9 years ago

No surprise. How have you mapped CapsLock to Control? (and why???)

rrthomas commented 9 years ago

I mapped CapsLock to control using the standard X option which is described in GNOME Tweak Tool as "Make Caps Lock an additional Ctrl", by X.org as the XkbOptions setting "ctrl:nocaps" (in /etc/X/xorg.conf).

I did it because CapsLock is an abomination, and that's the standard position for Ctrl, but I admit not everyone has that view; however, everything else in X (that I'm aware of) sees the key as Ctrl, including Cantata itself when processing keystrokes, and pretty obviously I expect apps to see the keys as I've chosen to map them, and not as they happen to be labelled (in fact, my keyboard has no labels either).

On 9 July 2015 at 19:57, CraigD notifications@github.com wrote:

No surprise. How have you mapped CapsLock to Control? (and why???)

— Reply to this email directly or view it on GitHub https://github.com/CDrummond/cantata/issues/695#issuecomment-120107873.

http://rrt.sc3d.org

CDrummond commented 9 years ago

Hmmm... Using dconf-editor:

select org.gnome > desktop > input-sources

Change xkb-options to ['ctrl:nocaps'](or add it to any existing options)

Now my CapsLock -> Ctrl. But this works before for short-cuts, AND in the settings page to assign a short-cut (Ctrl appears)

rrthomas commented 9 years ago

Something subtle is going on here. Looking at dconf myself, I find the setting I actually have is caps:ctrl_modifier. This is documented as: "Make Caps Lock an additional Control but keep the Caps_Lock keysym".

So I can see the potential for confusion.

However, I'm loth to fix it manually, because I didn't set it manually in the first place, but through GNOME's Tweak Tool, which presumably thinks there's a reason to use this setting. I can get "ctrl:nocaps" by changing the behavior of Ctrl.

It seems therefore that one can't rely on the keysym: it requires one to find out that the key is in this case a modifier.

CDrummond commented 9 years ago

Closing this, as the same 'issue' affects Clementine and KDE short-cut dialog. I have neither the time nor will to look into it further - patches welcome. However, 'ctrl:nocaps' seems to work...