guake icon indicating copy to clipboard operation
guake copied to clipboard

toggling guake show/hide under wayland looses focus

Open andreicristianpetcu opened this issue 10 years ago • 87 comments
trafficstars

Hi,

I am running Arch GNU/Linux with Gnome shell 3.16 on top of Wayland. I have F12 set to show/hide Guake but when I run it under Wayland and press F12 Guake does not appear. This happens when I have no other apps opened. If I have any app opened and focused (for example Firefox) and press F12, Guake appears.

Another related issue is once Guake is opened, if I press F12 again to close it, it does not close. I need to press other keys and then F12 in order for it to work.

Basically I cannot press F12/F12/F12.... to show/hide Guake. I managed to reproduce this on Arch with Gnome shell 3.14 and Wayland also, not only with 3.16. It runs perfectly on Xorg on both Gnome shell versions.

If you wish I can try to make a Vagrant box with GUI running a Fedora and I can make it easy for you to reproduce it.

PS: This bug it the only thing blocking me from switching to Wayland :P

Thank you for building Guake! :D

andreicristianpetcu avatar Apr 13 '15 09:04 andreicristianpetcu

I cannot reproduce it and don't have vagrant so if you have something to help I'll welcome it !

gsemet avatar Apr 13 '15 16:04 gsemet

Hmmm so your are you unwilling to install Vagrant? What distro are you using? What gnome shell version? I want to find a way for you to reproduce the issue. Thank you!

andreicristianpetcu avatar Apr 13 '15 23:04 andreicristianpetcu

Never used vagrant Ubuntu 14.04 gnome

gsemet avatar Apr 13 '15 23:04 gsemet

In order to reproduce this bug you need to run a fairly recent Gnome Shell under Wayland. How do you prefer to do this? I suggest using Vagrant even if you did not use it before since it is easy for you to use it. Will Ubuntu Gnome switch to Wayland soon?

andreicristianpetcu avatar Apr 14 '15 11:04 andreicristianpetcu

I cannot do anything that requires large among of work to change my environment. It will be easier for you if you try to debug the code yourself, there are log, it's python code so pretty easy to understand. I guess however this is a tricky bug :(

gsemet avatar Apr 14 '15 11:04 gsemet

I've just put a 10$ bounty on this bug on bountysource. I'll try to get more people interested in this bug, I hope it will change the priority from "Low" :P It breaks toggle functionality on new software and toggle functionality is a core feature of Guake I hope I'm not the only person with this issue :P https://www.bountysource.com/issues/11035271-toggling-guake-show-hide-under-wayland-looses-focus

andreicristianpetcu avatar Apr 14 '15 11:04 andreicristianpetcu

Will it be easier for you if I manage to give you a virtual machine with Ubuntu Gnome beta installed?

andreicristianpetcu avatar Apr 14 '15 11:04 andreicristianpetcu

yes it can :) I had tried to install gnome beta several months ago but I don't have the VM anymore :(

gsemet avatar Apr 14 '15 12:04 gsemet

Defect passed high for andrei

gsemet avatar Apr 14 '15 12:04 gsemet

Thank you! :D I'll try to make a Gnome VM in the following days. This will help you get a beta machine quite fast. But I will need to take a ubuntu 15.04 server or cloud, strap Gnome on it and export the VM somewhere.

andreicristianpetcu avatar Apr 14 '15 13:04 andreicristianpetcu

Making a Gnome Virtual Machine with both VirtualBox and Gnome Boxes failed. The current beta is pretty much broken. I don't want to get into more details. I managed to reproduce the bug on a Ubuntu Gnome 15.04 beta1 live USB.

  1. get the beta http://cdimage.ubuntu.com/ubuntu-gnome/releases/vivid/beta-1/ & write it on a USB
  2. boot form it
  3. connect to the Internet, open a terminal and run sudo apt-get update && apt-get install -y gnome-session-wayland && apt-get install -y guake
  4. logout from the menu and login back selecting Wayland like in this image http://worldofgnome.org/uploads/2014/03/wayland-gdm.png (leave the password empty)
  5. start guake
  6. leave all applications closed except for guake in the background and press "F12". Nothing happens. If you start Firefox and press F12 in Firefox, Guake pops up but if Firefox is closed it does not. Hope this helps you reproduce the bug on a environment similar to your dev env. It seems that I am not the only person that has/will have this problem https://plus.google.com/u/0/117017819812643628894/posts/YY363wktxV8 I hope this extra information is useful :)

andreicristianpetcu avatar Apr 15 '15 20:04 andreicristianpetcu

Just wanted to confirm bug on Arch running 3.16.1. Hot key works when guake preferences is in focus.

beanaroo avatar Apr 17 '15 15:04 beanaroo

I came to report the same thing. Also Arch running gnome 3.16.1

nilehmann avatar Apr 18 '15 02:04 nilehmann

Can also confirm this on Arch running Gnome 3.16.1

varemenos avatar Apr 28 '15 14:04 varemenos

I took a look at this. Sadly I haven't managed to fix the problem. However, I believe the problem resides in the globalhotkeys C code.

In the file keybinder.c during the initialization it calls gdk_window_add_filter, where the first parameter is a window and the second parameter is a function that will be called for each event produced in the window. As it is being called now, it does it with the root window gdk_get_default_root_window (). Reading the documentation for gdk_window_add_filter we find:

Pass NULL for window to get all events for all windows, instead of events for a specific window.

This is what I tried, and it did not make any difference.

If we uncomment the 21st line in keybinder.c and recompile it by running ./dev.sh, we will get additional terminal output when pressing F12. When pressing F12 a couple of times to reveal and hide Guake with a window in focus we get the following output:

Got accel 65481, 0 Got keycode 96 Got modmask 0 --no-startup-script argument defined, so don't execute the startup script Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 2, -1 Got KeyPress! keycode: 96, modifiers: 0 Calling handler for 'F12'... DBG Window display DBG: Showing the terminal do not set background from user Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 65, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 22, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 22, -1 Got Event! 22, -1 Got Event! 28, -1 Got Event! 19, -1 Got Event! 15, -1 Got Event! 12, -1 Got Event! 9, -1 Got Event! 65, -1 Got Event! 3, -1 Got KeyRelease! Got Event! 9, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 33, -1 Got Event! 33, -1 Got Event! 65, -1 Got Event! 65, -1 Got Event! 65, -1 Got Event! 65, -1 Got Event! 65, -1 Got Event! 65, -1 Got Event! 65, -1 Got Event! 65, -1 Got Event! 65, -1 Got Event! 10, -1 Got Event! 9, -1 Got Event! 10, -1 Got Event! 10, -1 Got Event! 2, -1 Got KeyPress! keycode: 96, modifiers: 0 Calling handler for 'F12'... DBG Window display DBG: gtk.gdk.WindowState = <flags GDK_WINDOW_STATE_STICKY | GDK_WINDOW_STATE_ABOVE of type GdkWindowState> DBG: gtk.gdk.WindowState = 40 DBG: GDK_WINDOW_STATE_STICKY? True DBG: GDK_WINDOW_STATE_WITHDRAWN? False DBG: GDK_WINDOW_STATE_ABOVE? True DBG: hiding the terminal Got Event! 18, -1 Got Event! 10, -1 Got Event! 10, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 28, -1 Got Event! 3, -1 Got KeyRelease!

I have highlighted the more interesting sections in bold.

If we change workspace in Gnome Shell to an empty one, i.e. where we don't have any window in focus, and press F12, these sections aren't produced. Therefore we can draw the conclusion that the keypress isn't detected since the output on line 168 in keybinder.c is never produced.

I don't know what is causing this behavior though; Wayland? Mutter? Globalhotkeys? Guake?

However, I see that there is a proposal, https://github.com/Guake/guake/issues/510, to replace Globalhotkeys with a different library. I don't know though. keybinder hasn't been updated since 2012, so I doubt it will make any difference to be honest.

I did this testing in a virtual machine running Ubuntu GNOME 15.04 32-bit. Since VirtualBox doesn't support Wayland (yet), I used VMware instead. However, VMware is proprietary and only has a free 30 days trial.

DanOpcode avatar May 10 '15 19:05 DanOpcode

Hello Can you try with the latest HEAD, we have switched to an keybinder module

gsemet avatar Jun 06 '15 09:06 gsemet

I'm trying to compile it. I have Fedora22. I followed these instructions https://github.com/Guake/guake#compilation

$git clone https://github.com/Guake/guake.git
$cd guake
$./autogen.sh
/usr/bin/gnome-autogen.sh
checking for automake >= 1.9...
  testing automake... found 1.15
checking for autoreconf >= 2.53...
  testing autoreconf... found 2.69
checking for glib-gettext >= 2.2.0...
  testing glib-gettextize... found 2.44.1
checking for intltool >= 0.25...
  testing intltoolize... found 0.51.0
checking for pkg-config >= 0.14.0...
  testing pkg-config... found 0.28
Checking for required M4 macros...
**Warning**: I am going to run `configure' with no arguments.
If you wish to pass any to it, please specify them on the
`./autogen.sh' command line.

Processing ./configure.ac
Running glib-gettextize... Ignore non-fatal messages.
Copying file po/Makefile.in.in

Please add the files
  codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4
  progtest.m4
from the /usr/share/aclocal directory to your autoconf macro directory
or directly to your aclocal.m4 file.
You will also need config.guess and config.sub, which you can get from
ftp://ftp.gnu.org/pub/gnu/config/.

Running intltoolize...
Running autoreconf...
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force --warnings=no-portability 
configure.ac:79: warning: macro 'AM_GCONF_SOURCE_2' not found in library
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
configure.ac:79: warning: macro 'AM_GCONF_SOURCE_2' not found in library
autoreconf: running: /usr/bin/autoconf --force --warnings=no-portability
configure.ac:79: error: possibly undefined macro: AM_GCONF_SOURCE_2
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

What am I doing wrong? :D

andreicristianpetcu avatar Jun 06 '15 12:06 andreicristianpetcu

yum install guake?

pypingou avatar Jun 06 '15 14:06 pypingou

The problem still appear on guake from git HEAD

nixtrian avatar Jun 06 '15 15:06 nixtrian

@pypingou it's actually dnf install guake :D I have it from the repos but since I reported this bug I wanted to check the HEAD version and install it from source and check if it is ok before it gets into other distros.

andreicristianpetcu avatar Jun 06 '15 16:06 andreicristianpetcu

@pypingou it's actually dnf install guake :D

You got me there, old habits die hard :D

I have it from the repos but since I reported this bug I wanted to check the HEAD version and install it from source and check if it is ok before it gets into other distros.

I used to have a daily rebuild of guake on copr, I should check if it is still working, let me get back to you on Monday, that should make testing easier ;-)

pypingou avatar Jun 06 '15 17:06 pypingou

Ok I managed to fix the build, here is the copr repo: https://copr.fedoraproject.org/coprs/pingou/guake/

pypingou avatar Jun 07 '15 09:06 pypingou

don't hesitate the modify the README if there are any dependency to add for fedora

gsemet avatar Jun 07 '15 09:06 gsemet

On Sun, Jun 07, 2015 at 02:58:06AM -0700, Gaetan Semet wrote:

don't hesitate the modify the README if there are any dependency to add for fedora

There is keybinder now :)

pypingou avatar Jun 07 '15 10:06 pypingou

I installed from the copr and keybinder. What am I doing wrong? :D

$guake
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/site-packages/guake/main.py", line 43, in <module>
    from guake.guake_app import Guake
  File "/usr/lib/python2.7/site-packages/guake/guake_app.py", line 49, in <module>
    import keybinder
ImportError: No module named keybinder

andreicristianpetcu avatar Jun 07 '15 11:06 andreicristianpetcu

you need keybinder library + the python wrapper (in debian/ubuntu, it is libkeybinder0 and python-keybinder)

gsemet avatar Jun 07 '15 12:06 gsemet

$sudo dnf install python-keybinder
$guake                                                                                                                                                   INFO:guake.guake_app:Logging configuration complete
/usr/lib/python2.7/site-packages/guake/guake_app.py:1624: GtkWarning: gtk_box_pack: assertion 'child->parent == NULL' failed
  self.mainframe.pack_start(self.mainframe, expand=True, fill=True, padding=0)

andreicristianpetcu avatar Jun 07 '15 12:06 andreicristianpetcu

I use pyenv for python versionion. Do I need to have something installed with pip for the local user?

andreicristianpetcu avatar Jun 07 '15 12:06 andreicristianpetcu

I installed it from the copr, I installed the keybinder related stuff and my Fedora broke. For some reason Plymouth seemed to freeze. I managed to jump into a console with Alt+F2 but I did not manage to fix the problem. I decided that I will loose less time if I nuke my Fedora and reinstall.

I suspect my problem is not related to Guake, I even managed to revert the last dnf transactions but it still did not boot. Even if I think this is not a Guake related issue I think it is important to post it here since the coincidence is quite strange. I will make a backup before the next time I install Guake from HEAD (master) as a precaution.

andreicristianpetcu avatar Jun 09 '15 07:06 andreicristianpetcu

I'm using the most current version on webupd8 (0.7.2) under Wayland and have what I think is the same issue (although it may differ). It seems to me that the behaviour is this:

When I'm running an x-native app (running via xwayland automatically), or if I'm in guake itself, the hotkey is recognized. But if I'm in a wayland app (or the desktop environment alone) the hotkey is not recognized.

I think the problem is GTK2 vs GTK3 shortcuts and how they're implemented (although I could be off-base here, that's just a rank guess). In any case, until this issue is fixed -- for anyone who loves guake and wants to keep using it, do this:

  • Open the keyboard shortcuts for your environment (for Gnome, that's Settings::Keyboard::Shortcuts)
  • Add a new shortcut named "Toggle Guake", with the command "guake -t", and set the hotkey for it

..this isn't exactly a fix, but it works very well, and it's enabled me to keep using Guake (which I like a lot). This fix is swift and responsive due to guake's nice DBus cli interface. Nice work on that, btw!

eode avatar Jul 07 '15 05:07 eode