feat: WindowRules Workspace Assignment - #137
Conversation
eb7d841 to
3fd458e
Compare
3fd458e to
98c92b5
Compare
73bcf86 to
d96ad98
Compare
|
|
||
| /// Get the current workspace assignment configuration | ||
| pub fn workspace_assignments(context: &cosmic_config::Config) -> Vec<WorkspaceAssignment> { | ||
| // Load custom assignments defined by the user. |
There was a problem hiding this comment.
Are ..WindowRules/v1/workspace_assignment_defaults likely?
Wondering if we should use the file workspace_assignment instead or something else if a different naming is preferred.
| Some(WorkspaceAssignment { | ||
| appid: assignment.appid.clone(), | ||
| title: assignment.title.clone(), | ||
| enabled: true, // Currently unused. |
There was a problem hiding this comment.
WorkspaceAssignment.enabled is not used in cosmic-comp.
We could instead have a WorkspaceAssignmentConfig struct { ... enabled: bool } and drop the enabled struct field from WorkspaceAssignment.
| return Vec::new(); | ||
| } | ||
| } | ||
| if why.is_err() |
There was a problem hiding this comment.
Clippy lint fix whilst in file, see: pop-os/cosmic-comp#2212
d96ad98 to
ccc11cd
Compare
ccc11cd to
bf74a86
Compare
bf74a86 to
74b9443
Compare
43f27af to
117942b
Compare
|
Rebased on 1.2.0. |
117942b to
e208651
Compare
|
Rebased on |
e208651 to
62d9a67
Compare
Workspace Assignments are a new feature enabling applications to be consistently launched automatically onto a specific workspace ID. This commit includes the config structs and getter functions for storing assignments, e.g: `com.system76.CosmicSettings.WindowRules/v1/workspace_assignment_custom` Default (CosmicDE defined) assignments are not currently supported but code and filenames have been chosen to avoid a conflict with the standard naming.
62d9a67 to
8755119
Compare
$ cat ~/.config/cosmic/com.system76.CosmicSettings.WindowRules/v1/workspace_assignment_custom
[
(
enabled: true,
appid: "cosmic-term",
title: ".*",
workspace_name: "terminal"
),
(
enabled: true,
appid: "firefox",
title: ".*",
workspace_name: "browser"
)
]I tried this rather than your example above, the only thing I changed was trying to set the terminal to |
|
Hi @jacobktm, can you please try with This is per this: nix-shell:~/src/github.com/karlskewes/cosmic-protocols]$ nix-shell -p pkg-config openssl wayland
nix-shell:~/src/github.com/karlskewes/cosmic-protocols]$ cargo run --example toplevel-list
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.02s
Running `target/debug/examples/toplevel-list`
Toplevel ObjectId(zcosmic_toplevel_handle_v1@4278190080)
Title: Some("~/src/github.com/karlskewes/nixos")
App ID: Some("kitty")
States: []
Outputs: []
Workspaces: []
Toplevel ObjectId(zcosmic_toplevel_handle_v1@4278190081)
Title: Some("feat: WindowRules Workspace Assignment by karlskewes · Pull Request #137 · pop-os/cosmic-settings-daemon — Mozilla Firefox")
App ID: Some("firefox")
States: []
Outputs: []
Workspaces: []
Toplevel ObjectId(zcosmic_toplevel_handle_v1@4278190082)
Title: Some("~/src/github.com/karlskewes/cosmic-protocols — COSMIC Terminal")
App ID: Some("com.system76.CosmicTerm")
States: [Activated]
Outputs: []
Workspaces: [] |
Feature
Extend
WindowRulesenabling launching applications/windows on specific workspaces instead of the current active workspace.Required for: pop-os/cosmic-comp#2214
How to use
Assign workspace names.
Pin workspaces using UI or via file:
Define Workspace Assignment configuration file with matching
name's:Disable the window rule by setting
enabled: false.Testing
nix buildnix developand thencargo checkNote to reviewers
This is my first contribution to Cosmic and I may have misunderstood or completely missed project structure/styling or other conventions. Please let me know and I'll rework accordingly. Thank you!
assign [class="<application_class>"] <workspace_number>path/to/WindowRules/workspace_assignment_custombecause it appears to be convention to have a file per feature, rather than a catch all../WindowRules/window_ruleswith features: sticky, tiling exceptions, workspace assignment, etcworkspace_assignment_defaultsfree for implementation if required.AI Disclosure
No AI generated code in the development of this PR.