layout: Do not update original output for named workspaces upon adding windows

The way named workspaces are generally used makes them more "attached" to their
original output.

For example, you have a two-monitor setup with named workspaces on both. When
you disconnect the monitor to go somewhere and work for a while, then return,
you probably want your named workspaces to return to where they were on your
second monitor.

This is in contrast to unnamed workspaces which are more transient and should
more easily follow you wherever you're working.
This commit is contained in:
Ivan Molodetskikh
2025-01-29 13:45:29 +03:00
parent 1c749f578c
commit 1d3820a064
3 changed files with 43 additions and 3 deletions
+9 -3
View File
@@ -259,7 +259,9 @@ impl<W: LayoutElement> Monitor<W> {
workspace.add_column(column, activate);
// After adding a new window, workspace becomes this output's own.
workspace.original_output = OutputId::new(&self.output);
if workspace.name().is_none() {
workspace.original_output = OutputId::new(&self.output);
}
if workspace_idx == self.workspaces.len() - 1 {
self.add_workspace_bottom();
@@ -311,7 +313,9 @@ impl<W: LayoutElement> Monitor<W> {
workspace.add_tile(tile, target, activate, width, is_full_width, is_floating);
// After adding a new window, workspace becomes this output's own.
workspace.original_output = OutputId::new(&self.output);
if workspace.name().is_none() {
workspace.original_output = OutputId::new(&self.output);
}
if workspace_idx == self.workspaces.len() - 1 {
// Insert a new empty workspace.
@@ -341,7 +345,9 @@ impl<W: LayoutElement> Monitor<W> {
workspace.add_tile_to_column(column_idx, tile_idx, tile, activate);
// After adding a new window, workspace becomes this output's own.
workspace.original_output = OutputId::new(&self.output);
if workspace.name().is_none() {
workspace.original_output = OutputId::new(&self.output);
}
// Since we're adding window to an existing column, the workspace isn't empty, and
// therefore cannot be the last one, so we never need to insert a new empty workspace.