Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to bind any hotkey under GNOME/Wayland #1642

Closed
jnsnow opened this issue Sep 5, 2019 · 28 comments
Closed

Unable to bind any hotkey under GNOME/Wayland #1642

jnsnow opened this issue Sep 5, 2019 · 28 comments

Comments

@jnsnow
Copy link

jnsnow commented Sep 5, 2019

I am using guake 3.6.3 on Fedora 30 under GNOME with Wayland.

When guake starts up, it renders the message "A problem happened when binding F12 key." and encourages me to pick a different key. The problem is that NO key appears to take at all, so I cannot toggle visibility.

This seems even worse than it used to be; where the hotkey would bind but would simply not work on wayland rendered windows.

I've tried completely resetting all gnome settings, guake settings, etc.

Expected behavior

I should be able to use a hotkey to open guake.

Actual behavior

No hotkey will bind. No key will toggle guake.

To Reproduce

I don't know. I'm using Fedora 30 as close to a vanilla configuration as I know how to create.


$ guake --support

Guake Version: 3.6.3

Vte Version: 0.56.3

Vte Runtime Version: 0.56.3


GTK+ Version: 3.24.10

GDK Backend: gi.GdkWaylandDisplay


Desktop Session: gnome


Display: wayland-0

RGBA visual: True

Composited: True

  • Monitor: 0 - CMN 0x14b1
    • Geometry: 1920 x 1080 at 3840, 0
    • Size: 310 x 170 mm²
    • Primary: False
    • Refresh rate: 60.01 Hz
    • Subpixel layout: unknown
  • Monitor: 1 - ACI VE247
    • Geometry: 1920 x 1080 at 1920, 0
    • Size: 530 x 300 mm²
    • Primary: False
    • Refresh rate: 60.00 Hz
    • Subpixel layout: unknown
  • Monitor: 2 - ACI VE247
    • Geometry: 1920 x 1080 at 0, 0
    • Size: 530 x 300 mm²
    • Primary: False
    • Refresh rate: 60.00 Hz
    • Subpixel layout: unknown
@jnsnow
Copy link
Author

jnsnow commented Sep 5, 2019

When running in verbose mode, I see messages like this:

reload_global: 'F10'

** (guake:15653): WARNING **: 14:31:54.045: Binding 'F10' failed!
can't bind show-focus key

I wanted to see what was going wrong, so I decided to track this along...

bash-5.0$ python3
Python 3.7.4 (default, Jul  9 2019, 16:32:37) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> gi.require_version('Keybinder', '3.0')
>>> from gi.repository import Keybinder
>>> 
>>> Keybinder.init()

(process:15987): Gdk-CRITICAL **: 14:40:18.287: gdk_keymap_get_for_display: assertion 'GDK_IS_DISPLAY (display)' failed

(process:15987): Gdk-CRITICAL **: 14:40:18.287: gdk_screen_get_root_window: assertion 'GDK_IS_SCREEN (screen)' failed

Well, that doesn't look good.

>>> Keybinder.bind('F12', lambda: print("Hello World! Hotkey Pressed!"))

(process:15987): Gdk-CRITICAL **: 14:42:50.108: gdk_screen_get_root_window: assertion 'GDK_IS_SCREEN (screen)' failed

(process:15987): Gdk-CRITICAL **: 14:42:50.108: gdk_keymap_get_for_display: assertion 'GDK_IS_DISPLAY (display)' failed
False

That doesn't look so good either.

@jnsnow
Copy link
Author

jnsnow commented Sep 5, 2019

I guess this is due to wayland not supporting hotkeys, so keybinder won't work at all anymore unless you are using XWayland, which is apparently not the case for F30, gnome and gtk3 apps now.

That's my understanding right now, anyway.

@j-frost
Copy link

j-frost commented Sep 7, 2019

I believe I have a similar issue. After updating my system I now get errors when starting up Guake that complain about not being able to bind my "Toggle Guake" hotkey (in my case, that's super+enter).


Guake Version:		3.6.3

Vte Version:		0.56.3

Vte Runtime Version:	0.56.3

--------------------------------------------------
GTK+ Version:		3.24.11

GDK Backend:		GdkX11.X11Display

--------------------------------------------------
Desktop Session: gnome

--------------------------------------------------
Display: :0

RGBA visual: True

Composited: True

* Monitor: 0 -  XWAYLAND0
    * Geometry:		1280 x 720 % 2 at 0, 0
    * Size:		310 x 170 mm²
    * Primary:		True
    * Refresh rate:	59.96 Hz
    * Subpixel layout:	unknown

@j-frost
Copy link

j-frost commented Sep 7, 2019

Workaround I stole from #1340 : I've bound super+enter to just "guake" in Gnome.

@jnsnow
Copy link
Author

jnsnow commented Sep 7, 2019

So, two things:

  1. If quake is running under XWayland, it probably ought to warn the user that hotkey support will only work sporadically. I.e., it will not work if any Wayland window has focus. Bonus points if it links to a github issue url in the console.

  2. If guake is itself running under Wayland, it should disable global hotkey bindings entirely as they will not work under any circumstance. A message akin to "Global hotkeys not presently available under Wayland" would at least reduce user confusion.

I suppose the only path forward right now is to wait for GNOME to offer a hotkey binding service under wayland.

@jnsnow
Copy link
Author

jnsnow commented Sep 8, 2019

I went through about the first seven pages of issues (Back to about ~900):

These are all effectively duplicates for the "Wayland Hotkey Bug":
#1640
#1448
#1041
#911
#492

There are some RFEs on how to remedy it:
#1343
#914

Various other hotkey issues that are not necessarily related:
1076, 1638, 1591, 1644, 1416

@gsemet Would you like assistance with github issue triage? I'm willing to spend some time trying to clean up the issue tracker.

@gsemet
Copy link
Member

gsemet commented Sep 8, 2019

Hi. Thanks. No pbl, if you want to be able to do a little bit of triage. Not enough time from my side to do this. I never used wayland so it is very difficult for me to debug anything related to it. So appart from documenting the work arround, there is no much what I can do.

Just go in the ticket and @gsemet me in the ticket you want me to update. If you do good job I'll give you the permission to do it on your own :)

@varantes-cit
Copy link

So, I'm having the same issue here.
Is this a Won't Fix for real?

Asking because here I cannot open Guake anymore (I cannot bind any key to do that). It will be very hard to keep working with Guake this way. =/

Guake Version:		3.6.3

Vte Version:		0.52.2

Vte Runtime Version:	0.52.2

--------------------------------------------------
GTK+ Version:		3.22.30

GDK Backend:		GdkX11.X11Display

--------------------------------------------------
Desktop Session: ubuntu-wayland

--------------------------------------------------
Display: :0

RGBA visual: True

Composited: True

* Monitor: 0 -  XWAYLAND0
    * Geometry:		1366 x 768 at 0, 0
    * Size:		310 x 170 mm²
    * Primary:		True
    * Refresh rate:	59.98 Hz
    * Subpixel layout:	unknown
* Monitor: 1 -  XWAYLAND1
    * Geometry:		2560 x 1440 at 1366, 0
    * Size:		550 x 310 mm²
    * Primary:		False
    * Refresh rate:	59.91 Hz
    * Subpixel layout:	unknown

@isashi
Copy link

isashi commented Oct 1, 2019

As suggested by @aurora-of-earth in #1640, under GNOME you can use the following workaround.
I tried it and in my case it works perfectly.

@isashi Guake doesn't support wayland very well, there's no problem with GNOME; You'll have the same sort of issue on KDE Plasma or any other desktop environment.
To fix this:

  • Remove the guake shortcut from inside of guake itself, if you've set it there at all.
  • Go to GNOME's Settings > Devices > Keyboard
  • Scroll down the screen and add a custom shortcut.(put 'guake' in the 'Command' field)

@j-frost
Copy link

j-frost commented Oct 1, 2019

The workaround works well in single monitor setups. Has varying issues when your active display is not 0 or main though...

@ghost
Copy link

ghost commented Oct 4, 2019

Had the same problem on ubuntu 19.10, did like descibed in #1640, works fine now

@isashi
Copy link

isashi commented Nov 4, 2019

Solution in #1640 is not valid in Fedora 31 (show: works properly / hide: glitch, often the terminal disappear and re-appear)

@gsemet
Copy link
Member

gsemet commented Nov 10, 2019

Pull request welcome. I do not use wayland so I cannot test anything :(

@mrshu
Copy link
Contributor

mrshu commented Jan 3, 2020

I believe it is simply not possible to bind hotkeys on Wayland. This seems to be seen as a security precaution (see albertlauncher/albert#309 for a longer discussion).

It seems the best thing to do for now would be to show some note to Wayland users (potentially with a link to one of the related issues) and invest into implementing the GAction mentioned in #1343.

@isashi
Copy link

isashi commented Jan 3, 2020

(at least) in Fedora 31, a possible wordaround, is to simply use xorg instead of wayland clicking on the gear icon before login

@rmeissn
Copy link

rmeissn commented Jan 31, 2020

I'm having the same problem running Fedora 31 on Wayland.
A good workaround is descibed by:

@isashi Guake doesn't support wayland very well, there's no problem with GNOME; You'll have the same sort of issue on KDE Plasma or any other desktop environment.
To fix this:

  • Remove the guake shortcut from inside of guake itself, if you've set it there at all.
  • Go to GNOME's Settings > Devices > Keyboard
  • Scroll down the screen and add a custom shortcut.(put 'guake' in the 'Command' field)

but I want to change it a little:

  • add guake to autostart on login
  • use guake-toggle for the keyboard-shortcut in gnome settings

The only annoying thing is that I'm unable to delete the toggle visibility shortcut in guake's settings itself, thus it's notifying me about being unable to bind the key on startup of the system.
Is there a way to get rid of this notification?

@iMartyn
Copy link

iMartyn commented Feb 28, 2020

@j-frost and others in the thread with the same issue - the monitor problems are a separate issue. guake-toggle should do exactly what the hotkey does, unfortunately there was a bug in 3.4.x, which was fixed in 3.5.0 and above so either upgrade / install with pip or apply the patch in #1450 to fix the mouse problem.

I can confirm that with 3.7.0 installed via pip3 install --user guake on debian works flawlessly with multi-monitor wayland and the workaround.

@gebau00a
Copy link

I'm having the same problem running Fedora 31 on Wayland.
A good workaround is descibed by:

@isashi Guake doesn't support wayland very well, there's no problem with GNOME; You'll have the same sort of issue on KDE Plasma or any other desktop environment.
To fix this:

  • Remove the guake shortcut from inside of guake itself, if you've set it there at all.
  • Go to GNOME's Settings > Devices > Keyboard
  • Scroll down the screen and add a custom shortcut.(put 'guake' in the 'Command' field)

but I want to change it a little:

  • add guake to autostart on login
  • use guake-toggle for the keyboard-shortcut in gnome settings

The only annoying thing is that I'm unable to delete the toggle visibility shortcut in guake's settings itself, thus it's notifying me about being unable to bind the key on startup of the system.
Is there a way to get rid of this notification?

You can use dconf-editor, apps/guake/keybindings/global/show-hide and set custom value to empty string.

@zevdg
Copy link

zevdg commented Aug 30, 2020

You can use dconf-editor, apps/guake/keybindings/global/show-hide and set custom value to empty string.

Setting it to empty string didn't work for me, but setting it to disabled did (source).

@gpeal
Copy link

gpeal commented Nov 5, 2020

One problem with the settings approach is that if you have "hide on lose focus" checked, pressing the hotkey hides guake instead of makes it visible if it is on screen but not focused. It then requires a second key press to show it again.

@msdrigg
Copy link

msdrigg commented Jun 21, 2021

Here's a simple bash script you can add to your F-12 gnome keyboard shortcut.

It handles the case where guake is not already open and opens it. Otherwise it just toggles it.

# guake-toggle only prints to stdout if guake is active  
if [ "$(guake-toggle)" == "" ]; then    
    # If guake isn't running, start it  
    guake &  
    # Also run guake-toggle with a delay to open guake  
    sleep 0.5;     
    guake-toggle;  
fi  

Note: This doesn't work if using "Hide on lose focus" as pointed out by @gpeal

@staticdev
Copy link

staticdev commented Jun 30, 2021

@zevdg @gpeal one solution that fixed for me and don't need an extra key is adding with dconf an extra keybinding for guake-toggle. I also made an ansible script for that:

- name: Add keybinding for Guake in Wayland
  community.general.dconf:
    key: "{{ item.key }}"
    value: "{{ item.value }}"
    state: present
  with_items:
    # values from gsettings list-recursively /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings
    - key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings"
      value: ["/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/guake/"]
    - key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/guake/binding"
      value: "'F12'"
    - key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/guake/command"
      value: "'/usr/bin/guake-toggle'"
    - key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/guake/name"
      value: "'Guake'"

Ideally, guake could detect it is running on Wayland and manage himself custom keybindings.

@Jeansen
Copy link

Jeansen commented Dec 17, 2021

  • Remove the guake shortcut from inside of guake itself, if you've set it there at all.
  • Go to GNOME's Settings > Devices > Keyboard
  • Scroll down the screen and add a custom shortcut.(put 'guake' in the 'Command' field)

This did the trick for me! 😄 But I cannot say, how well this works with KDE, since I am using GNOME.

For reference:
Guake Terminal: 3.8.1
VTE: 0.66.2
VTE runtime: 0.66.2
Gtk: 3.24.30

@Pysis868
Copy link

Pysis868 commented Dec 21, 2021

Same, distressing to see the years-long issue that may be specific to Wayland and needs the externally-bound guake-toggle workaround solution.

I think #1941 and #1942 only made some small changes, not the keybindings system re-implementation or other large changes that may have been mentioned elsewhere.

What's strange is I was customizing keyboard shortcuts in GNOME along with this application, and they were all working before some system updates where I'm sure a bunch of packages changed, also including kernel patch version updates, but were only done days apart from a fresh installation a week or 2 ago. I have not performed other serious system changes like at the login screen changing the display server (protocol?) from Wayland to Xorg, or similar through user login shell environment variable changes either. Only messing with NVIDIA drivers where the latest was visually buggy.

I just checked, and seems I only ever had that single version of guake, 3.7.0-9.fc35.

Just a note the relevant code using GTK bind is here:

if not self.guake.hotkeys.bind(value, self.guake.show_hide):

I had started to investigate the issue from pages like this one: https://askubuntu.com/questions/1128705/keyboard-shortcut-get-a-list-of-what-is-already-used

My system info:
Fedora 35 Workstation
Installed Guake through the default software catalog.

<details><summary>$ guake --support</summary>
Guake Version:		3.7.0
Vte Version:		0.66.1
Vte Runtime Version:	0.66.1
--------------------------------------------------
GTK+ Version:		3.24.30
GDK Backend:		__gi__.GdkWaylandDisplay
--------------------------------------------------
Desktop Session: gnome
--------------------------------------------------
Display: wayland-0
RGBA visual: True
Composited: True

@samtuke
Copy link

samtuke commented Dec 27, 2021

I seem to have this issue too. Gnome shortcuts don't list the key combo I want for Guake (left shift+ctrl). This is a fresh install, but Guake says the keys are in use.

@Davidy22
Copy link
Collaborator

Davidy22 commented Dec 27, 2021

The changes in #1941 were fairly hefty and addressed something completely unrelated to this issue.

Preventing programs from being able to pick up keyboard input when the program is not running is a "feature" of Wayland, binding guake-toggle using the system wide keyboard shortcut utility is the accepted solution, not a workaround. A workaround would be figuring out a way to defy the intentional limitation set out in the Wayland specification. Switched to wayland a few weeks ago so I could finally get first hand experience with the wayland related issues and this issue is solved by going into settings->keyboard shortcuts and binding a custom shortcut to guake-toggle. Guake still has the entry listed in the keyboard shortcuts menu for the users still on X11, but wayland will intentionally disregard it.

@Pysis868
Copy link

Then at least don't show an error message at every launch leading users to believe such. The hotkeys section of the settings interface could also mention a message to this effect depending on display server (protocol?).

@Davidy22
Copy link
Collaborator

Issue #2011 has been created to put first-time configuration for this on the to-do list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests