From 92c29300d7363b02807f5b5c1aa48eeef5e18bb2 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Tue, 22 Sep 2026 14:30:19 +0100 Subject: Use dynamic workspaces on the corporate desktop --- KEYBINDS.md | 4 ++++ docs/canonical-laptop.md | 3 +++ dot_local/lib/dotfiles/canonical_desktop.py | 3 +-- tests/test_canonical_desktop.py | 8 ++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/KEYBINDS.md b/KEYBINDS.md index ee60159..2352729 100644 --- a/KEYBINDS.md +++ b/KEYBINDS.md @@ -451,3 +451,7 @@ apply to this role. Super+L remains the GNOME lock shortcut. Super+D opens the application launcher. XF86Display remains the display-switching key; Super+P opens clipboard history. Super+1 through Super+9 select workspaces 1 through 9; Super+0 selects workspace 10. Add Shift to move the current window to that workspace. + +GNOME uses dynamic workspaces. Number shortcuts select existing workspaces; +they do not create missing ones. Empty workspaces are removed, so numbers can +change. GNOME keeps one empty workspace at the end for new windows. diff --git a/docs/canonical-laptop.md b/docs/canonical-laptop.md index 5bfb789..882318f 100644 --- a/docs/canonical-laptop.md +++ b/docs/canonical-laptop.md @@ -334,6 +334,9 @@ controls. Ubuntu AppIndicators supplies the tray. O-Tiling provides window tiling and movement. Emoji Copy uses Super+Period without a persistent panel icon. The custom `EXT`, `APT`, `FAIL`, and `REBOOT` status labels are disabled. +Workspaces are dynamic: unused workspaces are removed, with one empty workspace +kept at the end. Workspace numbers can change as empty workspaces are removed. + On an existing corporate installation, run outside the sandbox: ```sh diff --git a/dot_local/lib/dotfiles/canonical_desktop.py b/dot_local/lib/dotfiles/canonical_desktop.py index d530058..96e4e4e 100644 --- a/dot_local/lib/dotfiles/canonical_desktop.py +++ b/dot_local/lib/dotfiles/canonical_desktop.py @@ -220,8 +220,7 @@ def panel(saved: dict) -> None: def workspaces(saved: dict) -> None: - write_key("org.gnome.mutter", "dynamic-workspaces", False, saved) - write_key("org.gnome.desktop.wm.preferences", "num-workspaces", 10, saved) + write_key("org.gnome.mutter", "dynamic-workspaces", True, saved) for number in range(1, 11): key = str(number % 10) for action, modifier in [("switch", ""), ("move", "")]: diff --git a/tests/test_canonical_desktop.py b/tests/test_canonical_desktop.py index a8229bd..146ae9f 100644 --- a/tests/test_canonical_desktop.py +++ b/tests/test_canonical_desktop.py @@ -14,6 +14,14 @@ SPEC.loader.exec_module(desktop) class DesktopTests(unittest.TestCase): + def test_workspaces_are_dynamic_without_a_fixed_count(self): + with patch.object(desktop, "write_key") as write: + desktop.workspaces({}) + write.assert_any_call("org.gnome.mutter", "dynamic-workspaces", True, {}) + self.assertFalse( + any(call.args[1] == "num-workspaces" for call in write.call_args_list) + ) + def test_workspace_indicator_uses_numbers(self): with patch.object(desktop, "write_key") as write: desktop.tiling({}) -- cgit v1.3.1