From ffdae252782d047a6b2d76c9bb4efeb92c391db3 Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Sun, 28 Sep 2025 21:25:00 +0200 Subject: Context/desktop menu polish: real hover tint, real separator line, Select All Reported live: "looks weird and unpolished... need a lot more items". Compared directly against the exact AGS reference this project's own menu rebuild already targets rather than guessing: - Highlighted rows used a flat, fully-saturated fill instead of the reference's subtle 22%-accent-into-background wash. New decoration:: color::mix_rgb (channel-wise linear blend, generalizing brighten/ darken's fixed-target blends to an arbitrary second colour/ratio) lets render_context_menu reproduce that same ratio. - Every separator row was a label string of Unicode box-drawing characters rendered as text glyphs, which render inconsistently at small sizes - a label that's entirely U+2500 now draws a real 1px hairline instead; a label that mixes it with real text ("--- Move to Workspace ---", a deliberate section-header convention) still renders as text, unchanged. - "Select All" added to the bare-desktop menu, the one action every mainstream desktop's own menu offers that this one lacked. New tests needed real care: the panel's own rounded-corner distance field softens alpha within its radius of any canvas edge, not just the visible corners, so a naive full-row pixel scan against bg picked that up as a false positive on the first attempt - fixed by scanning only rows/columns confirmed (via a throwaway debug dump) to sit inside the panel's genuinely flat interior. Full workspace build/test/clippy clean, built and installed. Real submenus and per-row icons remain real, separate scope - this project's floating-menu UI has no nested-panel concept yet. --- crates/wayland/src/desktop_menu.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'crates/wayland/src/desktop_menu.rs') diff --git a/crates/wayland/src/desktop_menu.rs b/crates/wayland/src/desktop_menu.rs index 3cb90ed..dbbf957 100644 --- a/crates/wayland/src/desktop_menu.rs +++ b/crates/wayland/src/desktop_menu.rs @@ -30,6 +30,11 @@ pub(crate) enum DesktopMenuAction { /// concrete path to a real file manager's own richer menu (cut/copy/ /// paste, properties, ...), deliberately not reimplemented here. OpenInFileManager, + /// Selects every desktop icon at once - the one bare-desktop menu + /// action every mainstream file manager/desktop offers (Explorer, + /// Nautilus, Finder) that this menu had no equivalent for at all, + /// reported live as this menu needing "a lot more items". + SelectAll, Refresh, /// A purely visual divider row - see `context_menu::MenuAction:: /// Separator`'s own doc comment (same shape, same reason, separate @@ -78,6 +83,7 @@ impl DesktopMenu { ("Open Terminal Here", DesktopMenuAction::OpenTerminalHere), ("Open in File Manager", DesktopMenuAction::OpenInFileManager), ("\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}", DesktopMenuAction::Separator), + ("Select All", DesktopMenuAction::SelectAll), ("Refresh", DesktopMenuAction::Refresh), ]; Self { pos, width: MENU_WIDTH, row_height: ROW_HEIGHT, items } @@ -144,7 +150,7 @@ mod tests { let menu = DesktopMenu::open_for_desktop((10, 10)); let real_actions: Vec<&str> = menu.items.iter().filter(|(_, a)| !matches!(a, DesktopMenuAction::Separator)).map(|(l, _)| *l).collect(); - assert_eq!(real_actions, vec!["New Folder", "New Text Document", "Open Terminal Here", "Open in File Manager", "Refresh"]); + assert_eq!(real_actions, vec!["New Folder", "New Text Document", "Open Terminal Here", "Open in File Manager", "Select All", "Refresh"]); } #[test] -- cgit v1.2.3