Replaces the binary 1.3× hover with a true gaussian bell curve — the
hovered icon still peaks at ~1.35×, but the ±1 neighbours also bulge
noticeably, ±2 a bit, and ±3+ relax to 1.0×. Footprint ~5 icons wide,
matching the macOS Dock fisheye feel.
Implementation in fn icon_scale_for(id):
- Reads the hovered icon's and the current icon's bounds from
self.rectangles (already populated by the existing RectangleTracker
subscription — no new plumbing).
- Distance = |this_center - hovered_center| along the panel's long axis
(horizontal for Top/Bottom anchors, vertical for Left/Right).
- sigma = hovered_extent * 1.4 so the bell's half-width matches one
icon width (neighbors clearly pulled, far icons untouched).
- scale = 1.0 + PEAK * exp(-(d/sigma)²) with PEAK = 0.35.
- Falls back to binary 1.35×/1.0× when rectangle data isn't populated
yet (first render / resize) — visibly responsive even before the
tracker catches up.
No widget signature changes vs v1, just a smarter formula. All five
as_icon call sites already pass the result of icon_scale_for so this
update propagates everywhere.
Still on the TODO list: smooth animation (b). Right now icon→icon
transitions snap instantly; a smoothed_hover_center + tick subscription
would lerp it. Deferred to a follow-up commit.
First pass at the signature macOS Dock effect — the icon under the
pointer grows, adjacent icons stay at base size. Full fisheye (smooth
bell-curve scaling on neighbors) can be a later iteration.
Changes in cosmic-app-list/src/app.rs:
- CosmicAppList gains a hovered_dock_item: Option<DockItemId>
auto-initialized to None via #[derive(Default)].
- New Message::DockItemHover(Option<DockItemId>) handled in update()
by just writing the field; view() then reads it to decide scale.
- DockItem::as_icon gains an icon_scale: f32 parameter. Inside it the
cosmic_icon width/height = (base_icon_size * icon_scale) clamped
to u16; indicator dot and other surrounding layout stay at base
size so only the icon visually bulges.
- New App::icon_scale_for(id) helper: 1.3 if Some(id) == hovered,
1.0 otherwise. Single place to tune the magnification factor.
- The two main dock rows (favorites + filtered_active_list) wrap
their rendered applet_tooltip in widget::mouse_area with
on_enter(DockItemHover(Some(id))) / on_exit(DockItemHover(None))
and call icon_scale_for before rendering.
- The three remaining as_icon call sites (DnD preview, favorites
overflow popup, active overflow popup) pass icon_scale = 1.0 —
hover magnification on those surfaces would look jittery and isn't
needed anyway.
Build: cargo build --release -p cosmic-app-list (≈ 7s). Binary
installed at /usr/local/bin/cosmic-app-list, backup kept as
.pre-magnification.
Implement optional filtering of apps by active workspace or configured
output. The filter_top_levels config option accepts None (no filtering),
ActiveWorkspace (workspace-only), or ConfiguredOutput (monitor and
workspace filtering).
Signed-off-by: Tobias Schaffner <tobiasschaffner87@outlook.com>
With custom panel sizes, we use ranges that equal the values you would normally get from the hardcoded panel sizes
Update libcosmic
Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
In the workspace applet, this now uses `Workspace` in the front-end code
instead of a tuple with unnamed fields. Handling of scrolling is also
moved to the frontend, which uses less code and seems more natural. It
would be good to have a helper in libcosmic for this. It also changes
`ObjectId` to `ExtWorkspaceHandleV1`, which is a little simpler and I
see no reason here to avoid the more strongly typed object.
At some point we may want a shared subscription for workspaces in
multiple applets. As well as a higher-level abstraction for screen
capture.
Requires pop-os/cosmic-protocols#49.
The duplication between applets, and
cosmic-workspace/xdg-desktop-portal-cosmic, should be moved to shared
abstractions. But that can be done after moving to
`ext-image-copy-capture`.
`ToplevelInfo` now contains both ext and cosmic handles, so the tuples
of handles and info are needed. Use just the info.