Schneegans / Gnome-Pie

A pie menu launcher for linux. Read the release announcement of version 0.7.2 at https://schneegans.github.io/news/2018/10/30/gnome-pie-072 Or have a look at the homepage!
http://schneegans.github.io/gnome-pie.html
MIT License
309 stars 54 forks source link

Run on GDK 'x11' backend by default #173

Closed glitsj16 closed 4 years ago

glitsj16 commented 4 years ago

Hi, I've tested these patches quite thoroughly on Arch Linux and Ubuntu (xenial up to the latest release version). When the x11 GDK backend is available (which is as good as always IMHO) Gnome-Pie will regain all lost functionality compared to running on the wayland backend. This fixes #172.

As stated in the commit comment for the newly created gnome-pie-gdk-backends.vala, that file still needs to be integrated into the CMake routine. I didn't try to mess with that, as I have zero experience with it. SOMEONE WILL HAVE TO TAKE CARE OF THIS OR GNOME-PIE WILL NOT WORK AS EXPECTED.

Schneegans commented 4 years ago

Thank you so much! This looks very promising.

However, it would be great if it was possible to omit this extraneous executable. There seems to be the C-macro GDK_IS_X11_DISPLAY to check at runtime whether a display is a X11 display. Of course, this is not available in vala, but shouldn't it be sufficient to do a dynamic cast of the default display? I am thinking along those lines:

...
GLib.Environment.set_variable("GDK_BACKEND", "x11", true);
...
Gtk.init(ref args);
...
var display = Gdk.Display.get_default();
if (display is Gdk.X11.Display) {
  ...
  GLib.Environment.set_variable("GNOME_PIE_DISPLAY_SERVER", "x11", true);
  ...
}

What do you think? Do you have a setup to test this?

Thank you!

glitsj16 commented 4 years ago

There seems to be the C-macro GDK_IS_X11_DISPLAY to check at runtime whether a display is a X11 display. Of course, this is not available in vala, but shouldn't it be sufficient to do a dynamic cast of the default display?

You're absolutely right, this is much more elegant! I've tested it and it works great. It even removes the need to use Posix.system() calls to export the env vars (something I couldn't really account for). Edited PR accordingly. Looks pretty nice now, thanks for your decisive input!