Created
August 24, 2019 17:03
-
-
Save glitsj16/3ca06f56f93cc12773a79f0fff719557 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Patches against Gnome-Pie 0.7.2 to run on X11/Xwayland by default. | |
The Wayland display server is only used if the user explicitly starts | |
Gnome-Pie with the environment var GDK_BACKEND set to "wayland". | |
See https://github.com/Simmesimme/Gnome-Pie/issues/172 | |
--- a/src/daemon.vala | |
+++ b/src/daemon.vala | |
@@ -38,7 +38,7 @@ | |
public static string version; | |
///////////////////////////////////////////////////////////////////// | |
- /// Varaibles set by the commend line parser. | |
+ /// Variables set by the command line parser. | |
///////////////////////////////////////////////////////////////////// | |
public static bool disable_header_bar = false; | |
@@ -56,6 +56,25 @@ | |
public static int main(string[] args) { | |
version = "0.7.2"; | |
+ | |
+ // determine which display server to run on | |
+ if (GLib.Environment.get_variable("XDG_SESSION_TYPE") == "wayland") { | |
+ // run on Wayland when explicitly asked by the user | |
+ if (GLib.Environment.get_variable("GDK_BACKEND") == "wayland") { | |
+ GLib.Environment.set_variable("GNOME_PIE_WAYLAND", "yes", true); | |
+ Posix.system("export GNOME_PIE_WAYLAND=yes"); | |
+ } | |
+ else { | |
+ // run on X11/Xwayland by default for full functionality | |
+ GLib.Environment.set_variable("GDK_BACKEND", "x11", true); | |
+ GLib.Environment.set_variable("GNOME_PIE_WAYLAND", "no", true); | |
+ Posix.system("export GNOME_PIE_WAYLAND=no"); | |
+ } | |
+ } | |
+ else { | |
+ GLib.Environment.set_variable("GNOME_PIE_WAYLAND", "no", true); | |
+ Posix.system("export GNOME_PIE_WAYLAND=no"); | |
+ } | |
// disable overlay scrollbar --- hacky workaround for black / | |
// transparent background | |
@@ -81,7 +100,7 @@ | |
private Indicator indicator = null; | |
///////////////////////////////////////////////////////////////////// | |
- /// Varaibles set by the commend line parser. | |
+ /// Variables set by the command line parser. | |
///////////////////////////////////////////////////////////////////// | |
private static string open_pie = null; | |
--- a/src/actionGroups/groupRegistry.vala | |
+++ b/src/actionGroups/groupRegistry.vala | |
@@ -101,7 +101,7 @@ | |
///////////////////////////////////////////////////////////////////// | |
public static ActionGroup? create_group(string type_id, string parent_id) { | |
- bool wayland = GLib.Environment.get_variable("XDG_SESSION_TYPE") == "wayland"; | |
+ bool wayland = GLib.Environment.get_variable("GNOME_PIE_WAYLAND") == "yes"; | |
switch (type_id) { | |
case "bookmarks": | |
--- a/src/actionGroups/windowListGroup.vala | |
+++ b/src/actionGroups/windowListGroup.vala | |
@@ -36,7 +36,7 @@ | |
///////////////////////////////////////////////////////////////////// | |
public static GroupRegistry.TypeDescription? register() { | |
- if (GLib.Environment.get_variable("XDG_SESSION_TYPE") == "wayland") { | |
+ if (GLib.Environment.get_variable("GNOME_PIE_WAYLAND") == "yes") { | |
warning("The WindowList slice group is not supported on Wayland."); | |
return null; | |
} | |
--- a/src/gui/pieOptionsWindow.vala | |
+++ b/src/gui/pieOptionsWindow.vala | |
@@ -176,7 +176,7 @@ | |
public void show() { | |
this.window.show_all(); | |
- if (GLib.Environment.get_variable("XDG_SESSION_TYPE") == "wayland") { | |
+ if (GLib.Environment.get_variable("GNOME_PIE_WAYLAND") == "yes") { | |
this.optionsFrame.visible = false; | |
} | |
} | |
@@ -204,7 +204,7 @@ | |
this.trigger_button.set_trigger(trigger); | |
this.set_icon(pie.icon); | |
- if (GLib.Environment.get_variable("XDG_SESSION_TYPE") == "wayland") { | |
+ if (GLib.Environment.get_variable("GNOME_PIE_WAYLAND") == "yes") { | |
this.trigger_button.set_sensitive(false); | |
this.hint.set_line_wrap(true); | |
--- a/src/pies/defaultConfig.vala | |
+++ b/src/pies/defaultConfig.vala | |
@@ -69,7 +69,7 @@ | |
window.add_action(new KeyAction(_("Restore"), "view-restore", "<Alt>F5")); | |
// add a pie with window list group | |
- if (GLib.Environment.get_variable("XDG_SESSION_TYPE") != "wayland") { | |
+ if (GLib.Environment.get_variable("GNOME_PIE_WAYLAND") != "yes") { | |
var alt_tab = PieManager.create_persistent_pie("Alt Tab", "preferences-system-windows", new Trigger.from_string("<Control><Alt>T")); | |
alt_tab.add_group(new WindowListGroup(alt_tab.id)); | |
} | |
--- a/src/renderers/pieWindow.vala | |
+++ b/src/renderers/pieWindow.vala | |
@@ -60,8 +60,8 @@ | |
private int back_sz_y; | |
///////////////////////////////////////////////////////////////////// | |
- /// Some panels moves the window after it was realized. | |
- /// This value set the maximum allowed panel height or width. | |
+ /// Some panels move the window after it was realized. | |
+ /// This value sets the maximum allowed panel height or width. | |
/// (how many pixels the window could be moved in every direction | |
/// from the screen borders towards the center) | |
///////////////////////////////////////////////////////////////////// | |
@@ -69,7 +69,7 @@ | |
private int panel_sz = 64; | |
///////////////////////////////////////////////////////////////////// | |
- /// This value set the maximum allowed mouse movement in pixels | |
+ /// This value sets the maximum allowed mouse movement in pixels | |
/// from the capture to the show point in every direction. | |
///////////////////////////////////////////////////////////////////// | |
@@ -108,10 +108,10 @@ | |
private string search_string = ""; | |
///////////////////////////////////////////////////////////////////// | |
- /// Used to identify wayland sessions. | |
- ///////////////////////////////////////////////////////////////////// | |
- | |
- private bool wayland = GLib.Environment.get_variable("XDG_SESSION_TYPE") == "wayland"; | |
+ /// Used to identify Wayland sessions. | |
+ ///////////////////////////////////////////////////////////////////// | |
+ | |
+ private bool wayland = GLib.Environment.get_variable("GNOME_PIE_WAYLAND") == "yes"; | |
///////////////////////////////////////////////////////////////////// | |
/// C'tor, sets up the window. | |
@@ -217,7 +217,7 @@ | |
this.renderer.load_pie(pie); | |
if (wayland) { | |
- // wayland does not support client side window placement | |
+ // Wayland does not support client side window placement | |
// therefore we will make a fullscreen window | |
#if HAVE_GTK_3_22 | |
var monitor = Gdk.Display.get_default().get_monitor_at_point(this.back_x, this.back_y).get_geometry(); | |
@@ -260,7 +260,7 @@ | |
#endif | |
// allow some window movement from the screen borders | |
- // (some panels moves the window after it was realized) | |
+ // (some panels move the window after it was realized) | |
int dx = this.panel_sz - this.back_x; | |
if (dx > 0) | |
this.back_sz_x += dx; | |
@@ -424,7 +424,7 @@ | |
int center_x = this.renderer.center_x; | |
int center_y = this.renderer.center_y; | |
- // on wayland we have a fullscreen window and since we | |
+ // on Wayland we have a fullscreen window and since we | |
// do not get the pointer location until the mouse moved | |
// we can only display the pie centered... | |
if (this.wayland) { | |
--- a/src/utilities/bindingManager.vala | |
+++ b/src/utilities/bindingManager.vala | |
@@ -79,10 +79,10 @@ | |
private Keybinding? delayed_binding = null; | |
///////////////////////////////////////////////////////////////////// | |
- /// Used to identify wayland sessions. | |
- ///////////////////////////////////////////////////////////////////// | |
- | |
- private bool wayland = GLib.Environment.get_variable("XDG_SESSION_TYPE") == "wayland"; | |
+ /// Used to identify Wayland sessions. | |
+ ///////////////////////////////////////////////////////////////////// | |
+ | |
+ private bool wayland = GLib.Environment.get_variable("GNOME_PIE_WAYLAND") == "yes"; | |
///////////////////////////////////////////////////////////////////// | |
/// Helper class to store keybinding | |
@@ -117,7 +117,7 @@ | |
public void bind(Trigger trigger, string id) { | |
- // global key grabbing is impossible on wayland | |
+ // global key grabbing is impossible on Wayland | |
if (!wayland && trigger.key_code != 0) { | |
unowned X.Display display = Gdk.X11.get_default_xdisplay(); | |
X.ID xid = Gdk.X11.get_default_root_xwindow(); | |
@@ -158,7 +158,7 @@ | |
foreach (var binding in bindings) { | |
if (id == binding.id) { | |
if (binding.trigger.key_code == 0 || wayland) { | |
- //no key_code or wayland: just remove the bindind from the list | |
+ //no key_code or Wayland: just remove the bindind from the list | |
bindings.remove(binding); | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment