Commit graph

313 commits

Author SHA1 Message Date
Ian Douglas Scott
8d6bd47bc4 Take slice instead of array in set_workspace_coordinates
As far as I can tell this is equivalent, and there's no particular
reason to use an array. Arrays of options for variable-length arrays are
awkward.
2025-03-17 12:00:17 -07:00
Ian Douglas Scott
7340e2beff Improve handling of XDG activation tokens in shell
Requires https://github.com/Smithay/smithay/pull/1676.

This changes two things:
* `Workspace::is_empty` no longer checks if there are activation tokens,
  but a separate `Workspace::can_auto_remove` checks if the workspace is
  empty and has no activation tokens.
  - When we add workspace pinning, that can also be checked there.
* `Workspace` no longer contains a `pending_tokens` list that is updated
  on `refresh`. Instead, `can_auto_remove` takes the xdg activation
  state as an argument.

Since `Workspace::refresh` normally is run for focused workspaces, this
fixes allowing non-focused workspaces to be removed when an activation
token expires. It seems generally good to avoid tracking the activation
tokens in two places, and this is probably more efficient than needing
to refresh in more places.

By splitting this, we still don't remove an empty workspace if it has a
pending activation token, but we also don't add an empty workspace for
an activation token.

This mitigates the confusing behavior with activation tokens that aren't
used, but having to wait a few seconds in some cases before a workspace
is removed is still a little confusing. (We probably want `cosmic-term`
and `cosmic-workspace` to either consume the activation tokens they are
passed, or not be passed tokens when started by keybinding?)

Fixes https://github.com/pop-os/cosmic-comp/issues/1099.
2025-03-14 17:53:34 +01:00
Ian Douglas Scott
f8fae8a5b0 shell: On output_remove, focus moved workspace instead of empty one
On `output_remove`, if the output a workspace is moved to had no
non-empty workspaces (or did, but had an empty one active), the empty
workspace would remain active, and the workspace that was active on the
removed output is no longer visible.

Instead, change the active workspace to the one that was active on the
removed output.

This addresses another edge case where hotplug results in an empty
workspace, followed by other non-empty workspaces, and generally seems
like a better experience.

This could be further restricted by only applying if `new_set` is not on
the active output (to not mess with what the user is interacting with,
even it's an empty workspace) or only if the old `set` was the active
output, etc. But it seems good without further restriction.
2025-03-12 15:44:35 +01:00
Ian Douglas Scott
c72002e15a shell: If active workspace moved, add WState::Active to new active 2025-03-12 15:44:35 +01:00
Ian Douglas Scott
2b7f898e83 shell: Fix getting active_handle for other_set
Use `other_set.active`, not `set_active`.
2025-03-12 15:44:35 +01:00
Dusan
a96497f6f7 shell: next_output - axis overlap filter logic without negation
Signed-off-by: Dusan <dusanuveric@protonmail.com>
2025-03-05 18:24:28 +01:00
Victoria Brekenfeld
1a019280f3 actions: Remember previous workspace on extended action 2025-03-05 18:24:28 +01:00
Victoria Brekenfeld
d76f372c29 actions: Shortcut handling changes for #1005 2025-03-05 18:24:28 +01:00
Victoria Brekenfeld
638684642c stack: Remember position during continuous move action 2025-03-05 18:24:28 +01:00
Victoria Brekenfeld
e116f20396 stack: Remember previous position during focus navigation 2025-03-05 18:24:28 +01:00
Ian Douglas Scott
aac8166962 Add cosmic-workspace-v2, image source, toplevel info changes
This new protocol extends `ext-workspace-v1` with the same additional
functionality `cosmic-workspace-v1` provided. Toplevel info and toplevel
management are also updated to use ext handles, and there's an image
source for ext workspaces.

For now, the old protocol is still supported.
2025-03-03 12:30:25 +01:00
Ian Douglas Scott
47d142166b Set WorkspaceCapabilities::SetTilingState capability
`cosmic-comp` handles `SetTilingState` requests, so it looks like it was
incorrectly not advertising this.
2025-03-03 12:30:25 +01:00
Victoria Brekenfeld
c45a58c16c wayland: Implement cosmic-a11y-v1 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
3cff46d7e5 shell: Rescale zoom UI with zoom factor 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
f72d2b91f3 shell: Add zoom UI 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
55e4dd7c0f config: Handle zoom updates in Common::update_config 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
6fd1a48e60 grab: Refactor MenuGrab to be useful for zoom ui 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
b7d4a66c22 input: Zoom on Super+Scroll 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
7267c44116 shell: Cleanup zoom state 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
4f67e89373 shell: Reset focal point if cursor outside OnEdge area 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
15c5e3fe26 shell: don't accidentally reset zoom when using multiple seats (theoretically) 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
531a1c951f zoom: Handle multiple outputs 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
c01de20b2b shell: Allow triggering zoom 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
2e2943d99c render: Scale contents according to zoom_level 2025-02-20 23:51:55 +01:00
Daniel
2553810621
grabs: Snap Window Edges to Close Output Edges 2025-02-14 11:58:09 +01:00
Ian Douglas Scott
723f758439 protocol/workspace: Add support for ext-workspace-v1
To support both `ext-workspace-v1` and `cosmic-workspace-unstable-v1`,
the API exposed by `wayland/protocols/workspace` now uses the ext
workspace `State` and `GroupCapabilties` bitfields, and converts them to
the cosmic types for the cosmic implementation.

`WorkspaceCapabilities` is a custom type that has cosmic-specific and
ext-specific variants, and is mapped on both backends.

The ext protocol adds an `.assign` request on workspaces, which is
added here, though not currently used.

It also adds an `.id` event. Which we'll probably want when we have
persistent workspaces, but it isn't needed currently.

We still need to add an extension protocol of ext-workspaces to replace
a couple cosmic protocol features.
2025-02-13 11:31:38 +01:00
Victoria Brekenfeld
b793975689 shell: Don't animate programmatic maximize_requests 2025-02-07 13:02:42 +01:00
Victoria Brekenfeld
156f634944 shell: Handle maximize requests before commit 2025-02-07 13:02:42 +01:00
Ian Douglas Scott
3b0aa9e427 shell: Remove last workspace if it follows empty active workspace
Partly fixes
https://github.com/pop-os/cosmic-workspaces-epoch/issues/83, but it
seems like there's at least one other issue with workspaces not being
removed when they should be.

The if condition got a bit complicated here, so I've split it up and
inverted the condition.
2025-02-04 14:55:29 +01:00
Ian Douglas Scott
63995c4919 Remove CosmicMapped::stack_ref_mut
The methods of `CosmicStack` take `&self`, so this isn't actually needed
for anything.
2025-01-28 10:13:52 -08:00
Ian Douglas Scott
b685512127 Migrate away from Rectangle::from_loc_and_size
Deprecated in `smithay` by https://github.com/Smithay/smithay/pull/1621.
2025-01-07 12:50:35 +01:00
Victoria Brekenfeld
870e5be2a6 kms: Use scaled sizes for placing new outputs 2025-01-06 20:23:05 +01:00
Victoria Brekenfeld
db13eea91c shell: Allow active workspace to be None 2025-01-06 20:23:05 +01:00
David Brochero
68b6156aa8
Fix sticky toggle crashes on maximized windows (#1110) 2025-01-06 12:10:49 +01:00
Victoria Brekenfeld
f2e53f09c9 shell: Fix stacking maximized windows 2024-12-16 17:29:56 +01:00
Victoria Brekenfeld
2e1f6a4746 shell: Unset focused outputs on remove_output 2024-12-13 16:23:30 +01:00
Ian Douglas Scott
61692b21ad Run cargo format 2024-11-18 18:24:53 +01:00
Victoria Brekenfeld
0092dac08c input: Use render_input_order 2024-10-22 19:43:47 +02:00
Ian Douglas Scott
2497992d31 Don't create initial empty workspace when there are other workspaces
`WorkspaceSet::new()` now creates a set with no workspaces, instead of
one with a single workspace.
2024-10-21 18:10:53 +02:00
Ian Douglas Scott
229c794aad On adding output add set after processing other sets
Maybe there's some reason for this, but I don't think the first loop
needs to handle the new set.

I do not expect this to change behavior.
2024-10-21 18:10:53 +02:00
Ian Douglas Scott
fb2631adce Fix workspace indices when workspace is moved to another output
Previously, workspace numbering could end up with numbers skipped,
because an intermediate workspace was moved.
2024-10-21 18:10:53 +02:00
Ian Douglas Scott
c8ebac354c Preserve active workspace when workspaces are moved back to another output
Instead of preserving the active workspace index, which may not match if
a workspace before it has been moved back to another output.
2024-10-21 18:10:53 +02:00
Ian Douglas Scott
400a7752fd When moving workspaces on output remove, don't movve empty workspace
This resulted in a somewhat weird effect, where the empty workspace at
the end on the monitor has an `output_stack` with the other output, so
a window created there is moved back to to second output when it is
re-connected. This seems unexpected.
2024-10-21 18:10:53 +02:00
Ian Douglas Scott
6fc36cb00e Fix spelling of prefers 2024-10-21 18:10:53 +02:00
Vukašin Vojinović
b7a34bdd1e fix(menu): styling
Also improves the styling of resize indicators, and removes the unnecessary `.density()` method call for the SSD header.
2024-10-10 19:58:56 +02:00
Ian Douglas Scott
15a6425836
Set default output transform based on DRM panel orientation (#901) 2024-10-07 18:12:40 +02:00
Christian Meissl
afdb656778 dnd: correct handling of cursor buffer offset 2024-09-23 11:13:21 +02:00
Victoria Brekenfeld
9c7c41c508 toplevel-info/mgmt: Update to v2/v3 2024-09-23 10:55:00 +02:00
Victoria Brekenfeld
4d215755f6 shell: Fix incomplete focus_stack after swapping 2024-09-10 21:10:02 +02:00
Victoria Brekenfeld
03430b76c5 shell: Allow moving groups between outputs 2024-09-10 20:51:08 +02:00