Is there a way to give a keyboard shortcut defined in an application precedence over a system-wide shortcut with the same key binding?
Desired behaviour:
When some keys are pressed, check if the focussed application wants to do anything (and if so, do it). If not, check if there is a system shortcut for some keys and then do that.
What currently happens:
I have F11 set as 'toggle fullscreen' in the settings menu for keyboard shortcuts. In Chrome F11 should activate Chrome's own fullscreen mode, but instead is overridden by the system-wide shortcut, i.e. Chrome becomes fullscreen (GNOME panel and title bar vanish) but does not enter Chrome's fullscreen mode (where the tabs, address bar and bookmarks bar also vanish).
(Side note: Firefox does not have the same problem, but this seems to be because FF fullscreen is the same as/is triggered by the window manager fullscreen)
Best Answer
Disclaimer: This is not exactly what you want, but I've spent too much time on this not to post it and maybe someone else can use it.
I got as far as Ctrl + F11 is fullscreen everywhere but Chromium where it is Chromium's fullscreen !
I thought I might be able to trick the window manager if I use
xdotool
and send the command directly to the chrome window - to no avail.Then I thought I might be able to change the keyboard shortcut in google chrome, but that seems hardcoded - another dead end.
Install
xdotool
to simulate keyboard pressesreconfigure the Ubuntu Keyboard shortcuts to something arbitrary, that we never type but is usable in the script
Settings -> Devices -> Keyboard
Scroll down and edit Toggle fullscreen mode to
Ctrl + Alt + 1
and then hit the+
and add a custom keyboard shortcutand then hit the
+
and add a custom keyboard shortcutedit the script
make it executeable
It seems impossible to trick the windowmanager and smuggle keystroke by, but there are certainly workarounds possible. In this case Google made the fullscreen keyboard shortcut non-configureable, so it falls just short of the mark
Now with Ctrl + F11 the windowmanager controls the fullscreen behavior except in chromium.