Commit graph

133 commits

Author SHA1 Message Date
Ian Douglas Scott
b8780b9911 dbus: Add methods to show or hide 2025-09-22 14:41:29 -07:00
Ian Douglas Scott
c9a69bdfdb Expose DBus protocol with signals indicating when shown/hidden 2025-09-22 14:41:29 -07:00
Vukašin Vojinović
a939335b9e chore: Rust 2024 and update dependencies 2025-09-11 14:03:30 -07:00
Ian Douglas Scott
0375f28bb2 Fix a few build warnings 2025-08-22 13:11:32 -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
Ian Douglas Scott
20b694386d Drop capture received from backend if it no longer matches filter 2025-06-04 10:10:07 -07:00
Ian Douglas Scott
5351feb0ce Drop CaptureImages that don't match new capture filter 2025-06-04 10:10:07 -07: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
77ff4e62e9 Pass toplevel_capabilities from backend to frontend 2025-04-21 14:02:36 -07:00
Ian Douglas Scott
fc784af1b9 Fix building with mock-backend 2025-04-21 13:49:49 -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
ca23d3ad67 Use Layer::Top instead of Layer::Overlay
https://github.com/pop-os/cosmic-workspaces-epoch/issues/66. If we want
to hide the workspaces overlay when a popup is opened, that still needs
to be done, but using the same layer as the panel should be good in
general. There's no clear reason to have it on the `Overlay` layer.
2025-04-07 12:32:36 -07:00
Ian Douglas Scott
26b773c643 Use match instead of a couple if let branches 2025-04-07 08:20:51 -07:00
Ian Douglas Scott
f2a2904978 Filter WaylandEvent::RequestResize events out of subscriptions
There seems to be a flood of this event. Probably shouldn't be? In any
case, we don't use this event so we don't need to call `.update()` with
it.
2025-03-21 12:57:28 -07:00
Ian Douglas Scott
a9dcdce525 chore: update libcosmic 2025-03-14 13:42:42 -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
Ashley Wulber
7f877f72a3 fix: invert scroll direction 2025-02-20 18:52:53 -05:00
Ian Douglas Scott
4acd62abb0 Update for toplevel-info cctk changes 2025-02-13 11:46:45 -08:00
Ian Douglas Scott
52bbc6c083 Fix warnings and remove dbg! 2025-02-10 12:04:20 -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
136d02ce28 Fix disabled scroll accumulation 2025-02-06 13:37:53 -08:00
Ian Douglas Scott
5842829c59 Accumulate scroll events
Not sure the perfect way to do this; the workspace applet is a little
different.

A helper of some kind should be added to libcosmic.
2025-02-06 13:32:50 -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
Adam Cosner
fd0bdeebbf feat: Workspace view closing by pressing current workspace or empty space 2025-01-23 20:02:16 -08:00
Ian Douglas Scott
8a4d4b6957 Have icon_for_app_id run in a background thread
This should probably be faster, but it's good for things like this to
not block the UI thread regardless.

We could probably also cache for multiple apps with the same ID. Not
sure if there's a good way to detect changes to the icon for an app id
(Not really needed, probably?)
2025-01-21 09:24:19 -08:00
Peter Krull
0c9cabd21a performance: Add app_id check to throttle icon fetch 2025-01-21 08:50:55 -08:00
Ian Douglas Scott
e3b65d4772 Remove LayerShell only once iced confirms surface destroyed
Prevents "NO VIEW" messages, and possible flicker to placeholder widget.
2025-01-16 14:50:45 -08:00
Ian Douglas Scott
a428659ade Use std LazyLock instead of once_cell crate 2025-01-16 10:21:35 -08:00
Ian Douglas Scott
b259655839 Address some warnings 2025-01-16 10:19:58 -08:00
Ian Douglas Scott
5cb9f6eb09 Allow a couple clippy lints 2025-01-15 11:56:23 -08:00
Vukašin Vojinović
fe1363ea42 fix(interface): align closer to designs 2025-01-15 11:49:54 -08:00
Ian Douglas Scott
b70828e23f Update iced/libcosmic 2025-01-13 10:26:45 -08:00
Ian Douglas Scott
e0c0f27f67 On mock backend, don't hide when toplevel is opened
Toplevels are only added on this backend when the workspaces view is
shown.
2024-12-16 17:55:14 -08:00
Ian Douglas Scott
ef0d7bbc63 Close workspaces view if window spawns while open
We may want to adjust this if it sometimes leads to confusing behavior.
This may be better for now anyway.

Fixes https://github.com/pop-os/cosmic-workspaces-epoch/issues/28.
2024-07-29 22:14:47 -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
a014d8ca3d Unset drop_target after success, or close 2024-05-08 13:48: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
0f237155bf Clear drop_target when leaving drag 2024-05-02 08:05:51 -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