Bug 305434 - Window shortcut containing space: "Launch Mail" doesn't work
Summary: Window shortcut containing space: "Launch Mail" doesn't work
Alias: None
Product: kwin
Classification: Plasma
Component: rules (show other bugs)
Version: 4.9.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 4.11
Assignee: KWin default assignee
URL: https://git.reviewboard.kde.org/r/108942
Keywords: reproducible
Depends on:
Reported: 2012-08-19 14:52 UTC by kiwiiii
Modified: 2013-02-25 12:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.11
mgraesslin: ReviewRequest+


Note You need to log in before you can comment on or make changes to this bug.
Description kiwiiii 2012-08-19 14:52:03 UTC
When editing a rule for a window, in "Arrangement & Access" tab, "Shortcut" line: The input is a string, and not a standard shortcut button.
This is required since it can handle several shortcuts, and the rules mechanism will use the first available shortcut.

The issue is that it uses the space character to split the list of shortcuts, and some keys have spaces in their name, for example "Launch Mail", or "Volume Up".

For such keys the shortcut simply does not work.

I tracked down the code parsing the string: 
useractions.cpp:1745:void Client::setShortcut(const QString& _cut)

The code does a simple split on space. 

To fix this bug we would need either quoting or space escaping on keys that have a space in their name.

Another solution would be to guess if the invalid second shortcut (invalid because it has no modifier) is in fact part of the first shortcut, and then reparse it.
Comment 1 Martin Flöser 2013-02-13 12:00:35 UTC
Unfortunatelly it's not possible to fix it for 4.10.x. We need to switch from space to semicolon as separator and that means a string change which is not allowed.
Comment 2 Martin Flöser 2013-02-13 13:02:03 UTC
If you are able to put in a patch to your KWin, you can find a patch at:
Comment 3 Martin Flöser 2013-02-25 12:30:11 UTC
Git commit 30bc128ee829e2fcf001ba746f3dc2709b367643 by Martin Gräßlin.
Committed on 13/02/2013 at 13:57.
Pushed by graesslin into branch 'master'.

Store multiple shortcuts separated by " - " instead of space

Space is a valid shortcut part. E.g. "Volume Up".

KConfig update script for 4.11 is added to migrate existing and erroneous
rules taking into account that space is a valid key.
FIXED-IN: 4.11
REVIEW: 108942

M  +12   -1    kwin/data/CMakeLists.txt
A  +2    -0    kwin/data/kwin_update_411.upd
A  +95   -0    kwin/data/update_kwin_411.cpp     [License: GPL (v2)]
M  +1    -1    kwin/kcmkwin/kwinrules/editshortcut.ui
M  +3    -3    kwin/useractions.cpp