From b9911e7d269d31861d8749d2cdca9c6c69cd4f14 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 18 Jun 2024 08:39:53 +0200 Subject: src/: Re-introduce having a window manager (metacity this time, with keybindings disabled). Make having it conifugrable via GSettings. --- src/arctica-greeter.vala | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'src/arctica-greeter.vala') diff --git a/src/arctica-greeter.vala b/src/arctica-greeter.vala index e7a049d..119f3af 100644 --- a/src/arctica-greeter.vala +++ b/src/arctica-greeter.vala @@ -1278,6 +1278,7 @@ public class ArcticaGreeter : Object Pid atspi_pid = 0; Pid nmapplet_pid = 0; + Pid windowmanager_pid = 0; if (!do_test_mode) { @@ -1421,6 +1422,55 @@ public class ArcticaGreeter : Object activate_upower(); + string wm = AGSettings.get_string (AGSettings.KEY_WINDOW_MANAGER); + if (wm == "metacity") + { + try + { + string[] argv; + + Shell.parse_argv (wm, out argv); + Process.spawn_async (null, + argv, + null, + SpawnFlags.SEARCH_PATH, + null, + out windowmanager_pid); + debug ("Launched '%s' WM. PID: %d", wm, windowmanager_pid); + } + catch (Error e) + { + warning ("Error starting the '%s' Window Manager: %s", wm, e.message); + } + + Timeout.add (50, () => + { + try + { + string[] argv; + Pid wm_message_pid = 0; + + Shell.parse_argv ("%s-message disable-keybindings".printf(wm), out argv); + + Process.spawn_sync (null, + argv, + null, + SpawnFlags.SEARCH_PATH, + null, + null, + null, + null); + debug ("Launched '%s-message disable-keybindings' command", wm); + return false; + } + catch (Error e) + { + warning ("Error during '%s-message disable-keybindings' command call: %s", wm, e.message); + return true; + } + }); + } + greeter.greeter_ready.connect (() => { debug ("Showing greeter"); greeter.show (); @@ -1514,6 +1564,22 @@ public class ArcticaGreeter : Object debug ("GeoClue-2.0 agent terminated with signal %d", Process.term_sig (status)); geoclueagent_pid = 0; } + + if (windowmanager_pid != 0) + { +#if VALA_0_40 + Posix.kill (windowmanager_pid, Posix.Signal.TERM); +#else + Posix.kill (windowmanager_pid, Posix.SIGTERM); +#endif + int status; + Posix.waitpid (windowmanager_pid, out status, 0); + if (Process.if_exited (status)) + debug ("Marco Window Manager exited with return value %d", Process.exit_status (status)); + else + debug ("Marco Window Manager terminated with signal %d", Process.term_sig (status)); + windowmanager_pid = 0; + } } gsettings_mate_desktop_interface.set_int ("window-scaling-factor", wsf_orig); -- cgit v1.2.3