Commit graph

271 commits

Author SHA1 Message Date
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
Ian Douglas Scott
4637fcb655 widget/toplevel_item: Fix tree passed to layout() of second child 2025-04-17 13:22:34 -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
d4ddae7799 Fix "never read" lint 2025-04-15 14:17:23 -07:00
Ian Douglas Scott
74270a2deb Use ThreadExecutor instead of calloop executor
I thought the calloop executor had been fixed, but it still seems to
have issues that were preventing capture of continuous frames from
working consistently.

Fixes https://github.com/pop-os/cosmic-workspaces-epoch/issues/160.
2025-04-15 12:34:37 -07:00
Ian Douglas Scott
7ab1f93acf Add and use TwoRowColToplevelLayout
This tries to find a split point in the list of toplevels to maximize
the scale factor when calling `RowColToplevelLayout` twice. If it
doesn't get a better scale factor, it just uses a single row/column.

Some things don't seem quite right, but the existing layout is not
perfect, and this can help.

Without the added cross axis spacing, there's overlap, so there may be
something wrong with the requested sizes...
2025-04-08 16:25:16 -07:00
Ian Douglas Scott
1fd7a86ecc row_col_toplevel_layout: Add a new method 2025-04-08 16:25:16 -07:00
Ian Douglas Scott
5349f0f3d0 row_col_toplevel_layout: Take into account max cross axis in scale factor
Previous definition assumed the cross axis of a single window would not
need more downscaling than the total main axis of all children. But that
doesn't always work out.
2025-04-08 16:25:16 -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
874245bc2e Use aliasable in AxisToplevelLayout to use slice in argument
This makes layouts possible to compose without clones.
2025-03-24 14:59:25 -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
6f93a10560 Make dnd_destination code more generic 2025-03-18 13:30:37 -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
e283cfe456 Fix build with mock-backend feature 2025-02-10 14:05:31 -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
b5d2eed726 toplevel_layout: Add AxisToplevelLayout helper 2025-02-06 15:09:57 -08:00
Ian Douglas Scott
1342e37ad6 toplevel_layout: Make size depend on axis 2025-02-06 13:45:34 -08:00
Ian Douglas Scott
eb69aba7b2 toplevel_layout: Move logic into a requested_main_total method 2025-02-06 13:40:45 -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
207e7b2ff3 Fix building mock backend 2025-01-24 14:33:04 -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
Ian Douglas Scott
e032b0b5ee Center toplevels if they don't fill space 2025-01-22 13:42:04 -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
Ian Douglas Scott
392adda651 Run cargo clippy --fix 2025-01-15 11:53:59 -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
faa4a51fb9 Toplevel layout abstraction 2025-01-13 13:13:53 -08:00
Ian Douglas Scott
e1895ea3d7 Update dependencies 2025-01-13 10:42:44 -08:00