Commit graph

44 commits

Author SHA1 Message Date
Ian Douglas Scott
fcd8fa4336 size_cross_nth: Allocate space for widget out of remaining space 2025-05-29 19:31:01 -07:00
Ian Douglas Scott
4eac385992 two_row_col_toplevel_layout: Fix cross axis (vertical) spacing
Fixes two row layouts being cut off at the bottom.
2025-05-29 19:31:01 -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
655621fde0 Fix clippy lints 2025-04-21 11:32:07 -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ć
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
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
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
52bbc6c083 Fix warnings and remove dbg! 2025-02-10 12:04:20 -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
e032b0b5ee Center toplevels if they don't fill space 2025-01-22 13:42:04 -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
faa4a51fb9 Toplevel layout abstraction 2025-01-13 13:13:53 -08:00
Ian Douglas Scott
b70828e23f Update iced/libcosmic 2025-01-13 10:26:45 -08:00
Ian Douglas Scott
d05dfd7016 Add spacing between workspaces 2024-05-02 08:05:51 -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
7997d58ce7 Fix clippy lints 2024-04-24 13:51:20 -07:00
Ian Douglas Scott
ee1d54a12b Format imports 2024-04-24 13:00:40 -07:00
Ian Douglas Scott
8365efb30d Fix VisibilityWrapper widget
I believe this fixes how the widget works, though it's hard to tell
since the behavior was inconsistent.

There are still issues related to drag-and-drop in cosmic-comp or
`iced_sctk`, which need to be fixed to get things working fully.
2024-04-22 10:16:41 -07:00
Ian Douglas Scott
6f45933971 Fix various warnings 2024-04-19 15:44:55 -07:00
Ian Douglas Scott
09e03cd096 Hide toplevel from toplevel list when it is being dragged
Uses a custom wrapper widget, that makes `draw` do nothing when visible
is set to false.

This works well sometimes, but can cause weird bugs...
2024-04-19 15:28:16 -07:00
Ian Douglas Scott
7106001179 Address various warnings 2024-03-05 12:25:20 -08:00
Ian Douglas Scott
0dd3abf62c widgets/image_bg: Use layer in rendering
Fixes behavior with wgpu. It seemed to work with software renderer.
2024-02-29 15:51:55 -08:00
Ian Douglas Scott
015f61922b Update libcosmic 2024-02-06 13:32:29 -08:00
Ian Douglas Scott
d50c1f13f6 Fix subtract overflow 2024-01-26 13:04:58 -08:00
Ian Douglas Scott
82951822b9 If toplevels don't fit, scale by same factor 2024-01-22 17:19:46 -08:00
Ian Douglas Scott
7d0882162b Spacing fix 2024-01-22 13:40:10 -08:00
Ian Douglas Scott
99aeca0f2f Custom Toplevels widget
Fixes centering on toplevels.

Need to use fewer hacks, and add equal scale factor.

See if Iced layout system can be improved.
2024-01-19 15:32:54 -08:00
Ian Douglas Scott
ec5dceeed2 Custom widget to avoid stretching toplevel items
Avoids close button aligned way to right. And fixes offset for drag
surface.

But left aligns workspaces (need new container?).
2024-01-19 14:42:06 -08:00
Ian Douglas Scott
aac02973c1 Remove unused import 2023-12-20 14:46:43 -08:00
Ian Douglas Scott
06c37e39f5 WIP custom cursor for drag and drop 2023-12-15 15:46:41 -08:00
Ian Douglas Scott
d56a591a9f Passthrough widget implementation with treating as child 2023-12-15 13:39:02 -08:00
Ian Douglas Scott
c4adca76c0 Use delegate crate to simplify things a bit. 2023-12-15 13:33:29 -08:00
Ian Douglas Scott
0cebd30600 Fix excessive vertical height taken by button 2023-12-14 16:29:45 -08:00
Ian Douglas Scott
3ef8800fb4 Show background image
Harcoded path for now.
2023-12-13 17:58:38 -08:00
Ian Douglas Scott
a3e3bec885 Custom widget for sidebar; closing workspace
Need custom widget currently to distribute space correctly.
2023-12-13 15:54:33 -08:00