Bug 305437 - Window shortcuts should not be required to have a modifier: (usecase: media keys)
Summary: Window shortcuts should not be required to have a modifier: (usecase: media k...
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: rules (show other bugs)
Version: 4.9.0
Platform: Arch Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-19 15:04 UTC by kiwiiii
Modified: 2023-05-07 10:52 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
As you can see, I have multiple windows with shortcuts without modifiers. (894.87 KB, image/png)
2012-10-31 08:20 UTC, Emil Sedgh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kiwiiii 2012-08-19 15:04:45 UTC
It should be possible to use media keys on the keyboard without modifier for window shortcuts.
For example: I would like to use directly XF86Calculator, XF86Mail, XF86HomePage to focus on corresponding applications.

Reproducible: Always
Comment 1 Thomas Lübking 2012-08-19 15:27:38 UTC
Don't have here - can assign F6 perfectly (media keys do not work because of the space related bug)
Comment 2 Martin Flöser 2012-08-19 15:34:22 UTC
I can also assign F6 but it's not taken, setting Ctrl+F6 works, though
Comment 3 Thomas Lübking 2012-08-19 15:58:12 UTC
The "Single Shortcut" input dialog doesn't work (line remains empty) but just entering "F6" and applying the rule works perfectly here.
Comment 4 kiwiiii 2012-08-19 18:05:22 UTC
The code handling "Single Shortcut" explicitly checks for a modifier, and refuse the shortcut if there is no modifier by resetting the text box. This is also what the documentation says in the "Edit Shortcut" widget: "Only shortcuts with modifiers can be used."

So either we want a modifier, and then we must add more checks, or we don't want the modifier requirement, and the code and doc should be updated.
Comment 5 kiwiiii 2012-08-19 18:08:21 UTC
Furthermore, the code parsing the shortcut uses a regex with a '+': it supposes there is a modifier. If not matched, then the shortcut is ignored.
Comment 6 Emil Sedgh 2012-10-30 21:59:21 UTC
Kwin seems to work fine without any modifier for app-specific shortcuts.
Just try assigning a shortcut by tyipng it in the text box like 'F2'.

I have F1 to F5 currently assigned to my windows and it seems to work fine.
Comment 7 kiwiiii 2012-10-30 22:19:42 UTC
On kwin 4.9.2, there are two ways to set a shortcut for a window:
1/ on window title: right click, more actions, window shortcut:
The popup has a button to select a shortcut, and indeed it can take "F2" without modifier, but if you click ok, then "F2" doesn't show up the window, and if you go back to the popup shortcut selector, then it's back to "None".
If you set F2 with a modifier, it works, and it stays on the popup.


2/ by window rules, for example from window title: right click, more actions, special window settings:
shortcut, Force, Edit...
Here we have the "advanced" shortcut editor: a large text describing the advanced features (declaring a list of shortcut and using the first available).

If you write "F2" it's saved, but it doesn't work.
If you click "single shortcut" it opens the previous small popup, and if you hit "F2" then "ok", the text box stays blank (this is expected from reading the code, see comment 4), and obviously it doesn't work.
Comment 8 Emil Sedgh 2012-10-31 08:20:24 UTC
Created attachment 74898 [details]
As you can see, I have multiple windows with shortcuts without modifiers.
Comment 9 kiwiiii 2012-10-31 08:38:41 UTC
How have you added them? Maybe they are older than the code forcing modifiers when setting the shortcut.

If you add new ones, do they work?
Comment 10 Emil Sedgh 2012-10-31 09:07:00 UTC
I just added them.
Im using Kwin from git master.

On the application-specific settings window, after enabling 'Shortcut' item, do no click on 'Edit...' button. Just type in 'F2' in the text box.