Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Meta.WaylandClient for shell components #1761

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions src/PantheonShell.vala
Original file line number Diff line number Diff line change
@@ -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"};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a more useful way to test this replace dock with wingpanel and remove the TryExec for io.elementary.wingpanel from the wayland session settings and it works really fine apart from maximized windows disappearing behind the panel :)

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 ();
});
}
}
2 changes: 2 additions & 0 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ namespace Gala {

plugin_manager.load_waiting_plugins ();

PantheonShell.init (display);

return false;
});

Expand Down
1 change: 1 addition & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ gala_bin_sources = files(
'Main.vala',
'MediaFeedback.vala',
'NotificationStack.vala',
'PantheonShell.vala',
'PluginManager.vala',
'ScreenSaverManager.vala',
'ScreenshotManager.vala',
Expand Down
Loading