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

Workaround notifications bug #2269

Closed
wants to merge 1 commit into from
Closed
Changes from all 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
28 changes: 18 additions & 10 deletions src/WorkspaceManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,25 @@ public class Gala.WorkspaceManager : Object {
manager.workspace_switched.connect_after (workspace_switched);
manager.workspace_added.connect (workspace_added);
manager.workspace_removed.connect_after (workspace_removed);
display.window_entered_monitor.connect (window_entered_monitor);
display.window_left_monitor.connect (window_left_monitor);

// FIXME: we need this workaround because Meta.Workspace.window_added fires before Meta.Display.window_added
// and shell windows (e.g. notifications) are treated as normal windows
//
// Reported here:
// https://github.com/elementary/dock/pull/361#issuecomment-2657783172
//
// I suppose the best solution is to use Meta.Window.configure when we get newer mutter
// https://github.com/elementary/gala/issues/2216
wm.get_display ().window_created.connect ((window) => {
InternalUtils.wait_for_window_actor_visible (window, () => {
Idle.add (() => {
window_added (window.get_workspace (), window);
return Source.REMOVE;
});
});
});

// make sure the last workspace has no windows on it
if (Meta.Prefs.get_dynamic_workspaces ()
&& Utils.get_n_windows (manager.get_workspace_by_index (manager.get_n_workspaces () - 1)) > 0
Expand All @@ -75,7 +91,6 @@ public class Gala.WorkspaceManager : Object {
manager.workspace_added.disconnect (workspace_added);
manager.workspace_switched.disconnect (workspace_switched);
manager.workspace_removed.disconnect (workspace_removed);
display.window_entered_monitor.disconnect (window_entered_monitor);
display.window_left_monitor.disconnect (window_left_monitor);
}

Expand All @@ -85,7 +100,6 @@ public class Gala.WorkspaceManager : Object {
return;
}

workspace.window_added.connect (window_added);
workspace.window_removed.connect (window_removed);
}

Expand Down Expand Up @@ -135,6 +149,7 @@ public class Gala.WorkspaceManager : Object {
if ((window.window_type == Meta.WindowType.NORMAL
|| window.window_type == Meta.WindowType.DIALOG
|| window.window_type == Meta.WindowType.MODAL_DIALOG)
|| ShellClientsManager.get_instance ().is_itself_positioned (window)
&& workspace.index () == last_workspace
) {
append_workspace ();
Expand Down Expand Up @@ -183,12 +198,6 @@ public class Gala.WorkspaceManager : Object {
}
}

private void window_entered_monitor (Meta.Display display, int monitor, Meta.Window window) {
if (InternalUtils.workspaces_only_on_primary () && monitor == display.get_primary_monitor ()) {
window_added (window.get_workspace (), window);
}
}

private void window_left_monitor (Meta.Display display, int monitor, Meta.Window window) {
if (InternalUtils.workspaces_only_on_primary () && monitor == display.get_primary_monitor ()) {
window_removed (window.get_workspace (), window);
Expand Down Expand Up @@ -243,7 +252,6 @@ public class Gala.WorkspaceManager : Object {
return;
}

workspace.window_added.disconnect (window_added);
workspace.window_removed.disconnect (window_removed);

workspaces_marked_removed.add (workspace);
Expand Down