diff --git a/src/PantheonShell.vala b/src/PantheonShell.vala new file mode 100644 index 000000000..d186a7e23 --- /dev/null +++ b/src/PantheonShell.vala @@ -0,0 +1,46 @@ +public class Gala.PantheonShell : Object { + public static void init (Meta.Display display) requires (instance == null) { + instance = new PantheonShell (display); + } + + private static PantheonShell? instance = null; + + public Meta.Display display { get; construct; } + + private Meta.WaylandClient dock_client; + + private PantheonShell (Meta.Display display) { + Object (display: display); + } + + construct { + display.window_created.connect ((window) => { + if (dock_client != null && dock_client.owns_window (window)) { + setup_dock_window (window); + } + }); + + var subprocess_launcher = new GLib.SubprocessLauncher (NONE); + try { + dock_client = new Meta.WaylandClient (subprocess_launcher); + string[] args = {"io.elementary.dock"}; + dock_client.spawnv (display, args); + } catch (Error e) { + warning ("Failed to create dock client: %s", e.message); + } + } + + private void setup_dock_window (Meta.Window window) { + window.notify["above"].connect (() => { + if (!window.above) { + window.make_above (); + } + }); + + window.shown.connect (() => { + window.move_frame (false, 0, 0); + window.move_to_monitor (display.get_primary_monitor ()); + window.make_above (); + }); + } +} diff --git a/src/WindowManager.vala b/src/WindowManager.vala index ef238956e..2b7ed183b 100644 --- a/src/WindowManager.vala +++ b/src/WindowManager.vala @@ -369,6 +369,8 @@ namespace Gala { plugin_manager.load_waiting_plugins (); + PantheonShell.init (display); + return false; }); diff --git a/src/meson.build b/src/meson.build index a60a295e1..84e79a997 100644 --- a/src/meson.build +++ b/src/meson.build @@ -9,6 +9,7 @@ gala_bin_sources = files( 'Main.vala', 'MediaFeedback.vala', 'NotificationStack.vala', + 'PantheonShell.vala', 'PluginManager.vala', 'ScreenSaverManager.vala', 'ScreenshotManager.vala',