On my system (ubuntu 18.10), the code to detect the current screen is not working. If I use the old code from before commit c4b5b202ed5b0df3d7bf81046a40824a5ef2f778 it is working fine.
The issue is that when my cursor is on my primary screen, the dest_screen alternates between my primary screen (3), and screen 1 (my primary screen is screen 3, in a setup of 1 3 2).
Applying this patch on the latest master makes it work again.
diff --git a/guake/utils.py b/guake/utils.py
index ab1124a..20cf320 100644
--- a/guake/utils.py
+++ b/guake/utils.py
@@ -274,19 +274,11 @@ class RectCalculator():
dest_screen = settings.general.get_int('display-n')
if use_mouse:
- """
- TODO this is ported from widget.get_pointer() to
- GdkSeat.get_pointer(), but this whole method could be
- ported to Gdk (eg. gdk_display_get_default_screen(...)
- and gdk-screen-get-n-monitors(...))
- """
- gdk_window = window.get_window()
- if gdk_window is not None:
- display = Gdk.Display.get_default()
- seat = display.get_default_seat()
- device = seat.get_pointer()
- win, x, y, _ = gdk_window.get_device_position(device)
- dest_screen = screen.get_monitor_at_point(x, y)
+
+ # TODO PORT get_pointer is deprecated
+ # https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-get-pointer
+ win, x, y, _ = screen.get_root_window().get_pointer()
+ dest_screen = screen.get_monitor_at_point(x, y)
# If Guake is configured to use a screen that is not currently attached,
# default to 'primary display' option.
@michaelarnauts - You're solution worked for me.
Figured I'd put it here for reference.
guakeAttributeError: 'X11Display' object has no attribute 'get_default_seat'(I'm not really versed in gdk at all so my original hack was to just comment out the use_mouse statement which did the trick)
write please step by step solution to fix the problem with guake wrong monitor position
This fix worked for me. I performed the following steps on Debian with guake as installed from the debian unstable repo.
sudo vim /usr/lib/python3/dist-packages/guake/utils.py
searched for "use_mouse"
commented out the lines removed (marked red) above.
Added the new lines (marked in green) also removed the + symbols added by diff.
Restarted guake.
Issue was corrected.
It works for me too. How to ask developers to add this code to git?
@michaelarnauts have you submitted a PR for this yet?
Nope, this diff is a reverted change that the guake devs changed a while ago, they must have had a reason for this?
@aichingm @gsemet any reason for the change 3 months ago?
Probably a mistake :) feel free to propose a pull request !!
That was probably my fault, I wrote that section without testing it, haven't had a second monitor at hand while writing it.
From my PR https://github.com/Guake/guake/pull/1384:
I ported the monitor selection when using the "use_mouse" option to Gdk since the Gtk parts are deprecated, but some one should test them (I have currently only my laptop with me and no access to a second monitor)
I think it just slipped through testing...
Note to self: at some point this should be done (ported) properly!
Most helpful comment
This fix worked for me. I performed the following steps on Debian with guake as installed from the debian unstable repo.
Issue was corrected.