Commit graph

143 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
Vukašin Vojinović
e45d2ea694 chore: clippy 2026-02-20 23:54:21 +01:00
Lysander Treumann
f31e33ad30 Added feature "action on typing", i.e. cosmic-workspaces opens cosmic-launcher or cosmic-app-library, if the setting is set.
When opened by typing, cosmic-launcher or cosmic-app-library are closed when existing the workspaces overview.
Changed exiting workspaces overview by pressing Escape from KeyReleased to KeyPressed to improve interaction between cosmic-workspaces and cosmic-launcher/cosmic-app-library.
2026-01-31 04:17:14 +01:00
Ian Douglas Scott
a607da7f44 Use libcosmic DiscreteScrollState helper 2025-12-08 13:12:02 -08:00
Ian Douglas Scott
c5f777dc15 Adjust speed of pointer scrolling 2025-12-08 13:12:02 -08:00
Ian Douglas Scott
1e61881b4f Accumulate line scrolling
Combined with https://github.com/pop-os/iced/pull/244, discrete value120
scrolling works better.
2025-12-08 13:12:02 -08:00
Ian Douglas Scott
bd9e031912 Wrap workspace scrolling at start and end
Matches the behavior of scrolling over the applet. Seems reasonable.
2025-12-08 13:12:02 -08: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
Ian Douglas Scott
41a940660c Use subscriptions to monitor cosmic-panel configs 2025-11-13 16:27:28 -08:00
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