Commit graph

87 commits

Author SHA1 Message Date
Michael Aaron Murphy
2acf6f9f14 chore: apply rustfmt config with module import granulatiry 2026-04-29 21:41:03 +02:00
Ashley Wulber
240bb058a9 chore: update libcosmic after reexports were removed 2026-04-10 11:32:40 -06:00
José DE SOUSA
828534ad9c feat: add middle mouse button support to close toplevel applications 2026-03-26 14:57:35 -07:00
Ashley Wulber
d4becdd6c5 chore: updates after iced rebase 2026-03-17 16:06:09 -04:00
Vukašin Vojinović
87dca9eda4 improv(view): use ellipsis for labels 2026-02-20 23:54:21 +01:00
Vukašin Vojinović
5fbbf4ba37 chore: update dependencies 2026-02-20 23:54:21 +01:00
Vukašin Vojinović
db6fbfbce7 cleanup 2026-02-20 23:54:21 +01:00
Ian Douglas Scott
04edd3b909 Add margins for auto-hide panels without exclusive zones
Works alongside panel changes in
https://github.com/pop-os/cosmic-panel/pull/485.

We can't set an exclusive zone in the panel, since that would cause all
the workspaces to re-layout to make space for it, and also impact
workspace capture. Instead, cosmic-workspaces reads the config and adds
appropriate margins.
2025-11-13 16:27:28 -08:00
Vukašin Vojinović
a939335b9e chore: Rust 2024 and update dependencies 2025-09-11 14:03:30 -07:00
Ian Douglas Scott
6d86762152 Define Workspaces and Toplevels structs
This way methods can be called while other parts of `App` are mutably
borrowed.
2025-06-04 10:10:07 -07:00
Vukašin Vojinović
f76e547540 fix(view): scaling behavior
This should prevent the pin button and text being getting pushed out with horizontal workspaces and when scaling vertical workspaces.
2025-05-02 12:44:03 -07:00
Vukašin Vojinović
e2e0f09311 fix(view): match pin button appearance to designs 2025-04-24 17:08:15 +02:00
Ian Douglas Scott
3c9a923f41 Add support for workspace pinning and dragging
Workspaces can be pinned, and dragged to reorder or move to a different
output.

These features are enabled only if cosmic-workspace-v2 advertises the
necessary protocol version and capabilities.

The layout of the labels and pin buttons could be tweaked a bit still.
Some hacks and workarounds are needed to get drag and drop working as
desired. Something iced and libcosmic could potentially improve in the
future. But this now seems fairly robust.
2025-04-22 11:43:30 -07:00
Ian Douglas Scott
7037cd3d05 Activate workspace only if capability is present
Potentially relevant on compositors not advertising this, or if a
compositor wanted to advertise `Activate` support for some but not all
workspaces. This will be more relevant with other capabilities.
2025-04-21 13:20:42 -07:00
Ian Douglas Scott
655621fde0 Fix clippy lints 2025-04-21 11:32:07 -07:00
Ian Douglas Scott
62fbd056bf Store cctk::workspace::Workspace in struct Workspace
Instead of adding more fields to this struct that need to be copied from
the cctk type, just wrap it. Can add methods where that's convenient.
2025-04-21 10:36:44 -07:00
Ian Douglas Scott
bcb68ab054 widget/toplevel_item: Rename to size_cross_nth; take index argument
Name is a bit awkward, but useful for other purposes.
2025-04-17 13:45:55 -07:00
Vukašin Vojinović
588e889e0b chore(view): remove bg_element
This removes the unused `bg_element` function.
2025-04-16 18:25:04 -07:00
Vukašin Vojinović
2b7a8b133e improv(view): make workspace item sizing more dynamic
This makes the `workspace_bar` more responsive to different child sizes, which enables fixing the size of the smaller dimension of the screencopy, while allowing it to expand unrestricted in the larger dimension (to match the aspect ratio).
2025-04-16 18:25:04 -07:00
Ian Douglas Scott
6f93a10560 Make dnd_destination code more generic 2025-03-18 13:30:37 -07:00
Ian Douglas Scott
6b6bf454db Update to workspace v2, based on ext-workspace
Requires https://github.com/pop-os/cosmic-protocols/pull/51,
https://github.com/pop-os/cosmic-comp/pull/1225.

The new protocol version is a hard requirement, and this will panic
without it.
2025-03-07 22:24:36 -08:00
Ian Douglas Scott
4acd62abb0 Update for toplevel-info cctk changes 2025-02-13 11:46:45 -08:00
Ian Douglas Scott
ca5db9cc8e UI code for supporting workspace drags
Not used yet.
2025-02-10 12:02:36 -08:00
Ian Douglas Scott
9b12e76765 Rename DndWorkspaceDrag to DndToplevelDrag 2025-02-10 10:11:04 -08:00
Ian Douglas Scott
3d7d3823c4 Change workspace based on scroll events
Works, I'm not sure how many pixels to interpret as a change to the
workspace, and perhaps it should accumulate multiple deltas with a
timer. Assuming some lower level of the stack isn't doing that already.
I only see `ScrollDelta::Pixels` events, not `Lines`, though maybe
that's relevant with a different type of input device.

The behavior would also be clearer with animation, though it doesn't
seem to bad
(https://github.com/pop-os/cosmic-workspaces-epoch/issues/32).

Fixes https://github.com/pop-os/cosmic-workspaces-epoch/issues/34.
2025-02-06 13:32:50 -08:00
Ian Douglas Scott
a977667ac5 Use updated screencopy abstraction
Requires https://github.com/pop-os/cosmic-protocols/pull/46.
2025-02-04 13:58:20 -08:00
Ian Douglas Scott
ba52d69421 Add workspaces_for_output helper function 2025-01-24 15:30:15 -08:00
Ian Douglas Scott
88b35e3027 Allow dropping window onto toplevel list area
Fixes https://github.com/pop-os/cosmic-workspaces-epoch/issues/53.
2025-01-24 14:54:29 -08:00
Ian Douglas Scott
6838bd60be Remove unneeded field of DragSurface 2025-01-24 14:41:36 -08:00
Ian Douglas Scott
3dc82789f5 Move drag-and-drop related types to a dnd module 2025-01-24 14:28:42 -08:00
Ian Douglas Scott
efdfaed6c8 DropTarget enum instead of tuple; combine with DragId
I guess some change is needed for handling workspaces that span outputs
(can't encode both the workspace and output id in less than 64 bits, and
need bits for discriminant as well). But that's an issue with the
previous workspace index based approach.

I wonder if `drag_id` is really needed; libcosmic could check if the
drag is in bounds of the widget, if drag surfaces can't overlap...
2025-01-24 14:09:17 -08:00
Ian Douglas Scott
f532205bf9 view: Add DragId helper to manage multiple types of destinations 2025-01-24 13:24:13 -08:00
Adam Cosner
fd0bdeebbf feat: Workspace view closing by pressing current workspace or empty space 2025-01-23 20:02:16 -08:00
Vukašin Vojinović
fe1363ea42 fix(interface): align closer to designs 2025-01-15 11:49:54 -08:00
Ian Douglas Scott
764b4ae5f8 Apply screencopy transform to subsurfaces
Fixes https://github.com/pop-os/cosmic-workspaces-epoch/issues/17.
2025-01-15 10:18:50 -08:00
Ian Douglas Scott
b70828e23f Update iced/libcosmic 2025-01-13 10:26:45 -08:00
Ian Douglas Scott
686f4e764f Don't show background; rely on cosmic-comp for that
Requires https://github.com/pop-os/cosmic-comp/pull/609, or this will
show all the open windows.
2024-07-15 11:34:54 -07:00
Ian Douglas Scott
7ff45540e8 Deduplicate drag_surface code a bit 2024-07-15 11:32:07 -07:00
Ian Douglas Scott
e9e6cc275b Move drag surface view into a function
It's a bit clearer this way.
2024-07-10 18:41:34 -07:00
Ian Douglas Scott
594ecffa66 Apply both offset and alpha to drag surfaces 2024-06-12 09:40:13 -07:00
Ian Douglas Scott
30b0cfe17b Fix handling leave event to one widget after enter for another 2024-05-02 12:53:09 -07:00
Ian Douglas Scott
ccef25c40c Use subscription for cosmic-bg-config
Works, as long as a `config_state_subscription` is used.

Should also try caching image handles.
2024-05-02 08:05:51 -07:00
Ian Douglas Scott
6cca5476ab User hover style for drop target 2024-05-02 08:05:51 -07:00
Ian Douglas Scott
b635c10837 Add offset logic, commented
With large drag surfaces, and no tranparency, this seems a bit akward
when not dragging from near top left. May be better with cursor
indicator.
2024-05-02 08:05:51 -07:00
Ian Douglas Scott
249c62ee0a Update libcosmic/iced 2024-04-30 16:25:50 -07:00
Ian Douglas Scott
d759e1d7c2 Use cosmic_bg_config to get background
Scaling doesn't match `cosmic-bg`?
2024-04-30 12:49:08 -07:00
Ian Douglas Scott
96cca005b7 Rename inaccurately named widget 2024-04-25 14:17:43 -07:00
Ian Douglas Scott
8f571e9e25 Use custom style for workspace items
None of the default styles seem to work quite right here.
2024-04-25 14:10:09 -07:00
Ian Douglas Scott
7997d58ce7 Fix clippy lints 2024-04-24 13:51:20 -07:00
Ian Douglas Scott
76daf6e980 Update libcosmic/iced for drag-and-drop fixes 2024-04-24 12:46:57 -07:00