Skip to content

Commit

Permalink
Reload workspace clones when monitors change (#1788)
Browse files Browse the repository at this point in the history
Co-authored-by: Danielle Foré <[email protected]>
  • Loading branch information
lenemter and danirabbit authored Nov 7, 2023
1 parent 3fbdea9 commit ad90fee
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
3 changes: 3 additions & 0 deletions data/gala.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
<issue url="https://github.com/elementary/gala/issues/695">Wrong workspaces behavior</issue>
<issue url="https://github.com/elementary/gala/issues/1109">Use gestures for "move to workspace"</issue>
<issue url="https://github.com/elementary/gala/issues/1261">Alt + Shift unnecessarily blocked when there is only one keyboard layout</issue>
<issue url="https://github.com/elementary/gala/issues/1518">Multitasking view breaks when switching displays &amp; strange Wingpanel position</issue>
<issue url="https://github.com/elementary/gala/issues/1750">Disconnecting external monitor breaks the multi-tasking view</issue>
<issue url="https://github.com/elementary/gala/issues/1753">Workspace wallpaper's aspect ratio with different monitors</issue>
<issue url="https://github.com/elementary/gala/discussions/1764">Counter Strike 2 causes segfault in libmutter on exit</issue>
<issue url="https://github.com/elementary/gala/issues/1774">Scheduled switch to dark style does not dim the wallpaper after cold reboot on elementary OS 7.1</issue>
<issue url="https://github.com/elementary/gala/issues/1783">Notifications appear in the middle of the screen</issue>
Expand Down
21 changes: 16 additions & 5 deletions src/Widgets/MultitaskingView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ namespace Gala {
add_child (primary_monitor_container);
add_child (dock_clones);

unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
for (int i = 0; i < manager.get_n_workspaces (); i++) {
add_workspace (i);
}

unowned var manager = display.get_workspace_manager ();
manager.workspace_added.connect (add_workspace);
manager.workspace_removed.connect (remove_workspace);
manager.workspaces_reordered.connect (() => update_positions (false));
Expand Down Expand Up @@ -141,6 +137,8 @@ namespace Gala {
* MonitorClones at the right positions
*/
private void update_monitors () {
update_workspaces ();

foreach (var monitor_clone in window_containers_monitors) {
monitor_clone.destroy ();
}
Expand Down Expand Up @@ -176,6 +174,19 @@ namespace Gala {
}
}

private void update_workspaces () {
foreach (unowned var child in workspaces.get_children ()) {
unowned var workspace_clone = (WorkspaceClone) child;
icon_groups.remove_group (workspace_clone.icon_group);
workspace_clone.destroy ();
}

unowned var manager = display.get_workspace_manager ();
for (int i = 0; i < manager.get_n_workspaces (); i++) {
add_workspace (i);
}
}

/**
* Scroll through workspaces with the mouse wheel. Smooth scrolling is handled by
* GestureTracker.
Expand Down
2 changes: 2 additions & 0 deletions src/Widgets/WorkspaceClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ namespace Gala {
listener.window_no_longer_on_all_workspaces.disconnect (add_window);

background.destroy ();
window_container.destroy ();
icon_group.destroy ();
}

private void reallocate () {
Expand Down

0 comments on commit ad90fee

Please sign in to comment.