feat: per-application workspace assignment rules - #2556
Open
AldenDana wants to merge 5 commits into
Open
Conversation
Author
|
AI disclosure This implementation was developed with assistance from Claude (Anthropic's AI coding assistant), directed and reviewed by me throughout — I specified the requirements, reviewed the generated diffs, and tested every feature live on my own machine. I'm continuing to work with Claude to address review feedback, so turnaround should be quick either way.
|
Adds a workspace_assignments config (list of app_id -> workspace
number, 1-based) to com.system76.CosmicComp. When a new window's
app_id matches a rule, it is mapped to the configured workspace
instead of the active one, regardless of how the app was launched.
The target workspace is flagged urgent rather than stealing focus,
matching existing behavior for windows mapped to inactive workspaces.
Rules hot-reload via cosmic-config like other compositor settings.
Example (~/.config/cosmic/com.system76.CosmicComp/v1/workspace_assignments):
[
(app_id: "code", workspace: 5),
]
Implements pop-os/cosmic-epoch#1395 / pop-os/cosmic-workspaces-epoch#186.
AI-assisted commit: implemented with Claude (Anthropic's AI coding assistant); the author directed the requirements, reviewed the generated diff, and tested the resulting behavior.
Adds an 'Always open on this workspace' toggle to the window menu, next to 'Always on Visible Workspace'. Pinning stores an (app_id, workspace) rule in workspace_assignments via cosmic-config (so it hot-reloads and stays the single source of truth); the entry then reads 'Always opens on workspace N' with a checkmark, and clicking it again removes the rule. AI-assisted commit: implemented with Claude (Anthropic's AI coding assistant); the author directed the requirements, reviewed the generated diff, and tested the resulting behavior.
Right-click on the title bar only reaches windows using server-side decoration. Most modern apps (GTK4, Qt6, Electron, libcosmic itself) draw their own client-side title bar, so the compositor renders none for them and there was previously no way to reach this menu at all for such windows - including the 'Always open on this workspace' item from the workspace-assignments branch. Hardcoded to Super+M (bypassing the configurable shortcuts system, which lives in a separate crate) since it's compositor-internal, mirroring the existing pattern for Escape/Resizing PrivateActions. Opens at the focused window's top-left corner; menu_request already derives the rest of the window's geometry from the surface. AI-assisted commit: implemented with Claude (Anthropic's AI coding assistant); the author directed the requirements, reviewed the generated diff, and tested the resulting behavior.
Advertise the Rename capability and act on zcosmic_workspace_handle_v2 rename requests: update the in-memory workspace name and persist it for pinned workspaces, mirroring how pinned state is already saved. AI-assisted commit: implemented with Claude (Anthropic's AI coding assistant); the author directed the requirements, reviewed the generated diff, and tested the resulting behavior.
Super+M is already bound to Maximize by default (com.system76.CosmicSettings.Shortcuts/v1/defaults). The hardcoded intercept ran before the configurable shortcuts lookup, so it silently swallowed the keypress and broke Maximize. Alt+Space is unused and is the traditional "open window system menu" shortcut. AI-assisted commit: implemented with Claude (Anthropic's AI coding assistant); the author directed the requirements, reviewed the generated diff, and tested the resulting behavior.
AldenDana
force-pushed
the
workspace-assignments
branch
from
July 13, 2026 21:22
a692266 to
b5a6da2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements pop-os/cosmic-epoch#1395 / pop-os/cosmic-workspaces-epoch#186: opening an app always places it on a chosen workspace.
Adds a
workspace_assignmentsconfig tocom.system76.CosmicComp— a list of(app_id, workspace)rules (workspace numbers 1-based, matching the UI). When a new window'sapp_idmatches, it maps to that workspace instead of the active one, regardless of launch origin; the target workspace is flagged urgent rather than stealing focus (same behavior as other windows mapped to inactive workspaces). Rules hot-reload like other compositor settings.Rules can be managed from the window context menu: right-click a titlebar → Always open on this workspace toggles a rule for that app on the window's current workspace (the entry then shows Always opens on workspace N with a checkmark). The menu writes through cosmic-config, so the config file stays the single source of truth:
Alt+Space opens the window menu. Not every window has a compositor-drawn titlebar to right-click — client-side-decorated windows (most GTK4/Qt6/Electron/libcosmic apps, including COSMIC's own Files) have none, so there was previously no way to reach the context menu (and therefore the workspace-assignment toggle) for them at all. Alt+Space is added as a hardcoded, non-configurable compositor shortcut (
PrivateAction::OpenWindowMenu) that opens the menu for the currently focused window regardless of decoration mode — chosen because it's unused by default and is the traditional "window system menu" shortcut on other desktops (Super+M was the first attempt, but that's already bound to Maximize by default, so it's Alt+Space instead).Rename support. The
zcosmic_workspace_handle_v2::renamerequest was defined in the protocol but never handled compositor-side; this wires it up (advertises theRenamecapability, applies the name, and persists it for pinned workspaces) so clients can let users rename workspaces.Happy to follow up with a cosmic-settings page for bulk management if the config shape is acceptable.