srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/wayland/src/state/desktop_icons.rs
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2025-09-28 21:25:00 +0200
committersrdusr <[email protected]>2025-09-28 21:25:00 +0200
commitffdae252782d047a6b2d76c9bb4efeb92c391db3 (patch)
tree11ddf590e643e55cdb1e907c0f236dd077236e03 /crates/wayland/src/state/desktop_icons.rs
parent58a368df5f7a5d579335d1cb68213baacba5bc63 (diff)
downloadsrdwm-ffdae252782d047a6b2d76c9bb4efeb92c391db3.tar.gz
srdwm-ffdae252782d047a6b2d76c9bb4efeb92c391db3.zip
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.
Diffstat (limited to 'crates/wayland/src/state/desktop_icons.rs')
-rw-r--r--crates/wayland/src/state/desktop_icons.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/wayland/src/state/desktop_icons.rs b/crates/wayland/src/state/desktop_icons.rs
index 81a8ed8..a1b1968 100644
--- a/crates/wayland/src/state/desktop_icons.rs
+++ b/crates/wayland/src/state/desktop_icons.rs
@@ -218,6 +218,24 @@ impl CompState {
}
}
+ /// Selects every desktop icon at once - the bare-desktop menu's own
+ /// "Select All" action (see `DesktopMenuAction::SelectAll`'s own doc
+ /// comment). Same "only rebuild the buffers that actually changed"
+ /// shape as `select_desktop_icon`.
+ pub(crate) fn select_all_desktop_icons(&mut self) {
+ let Some(icons) = &mut self.desktop_icons else { return };
+ let mut changed = Vec::new();
+ for icon in &mut icons.icons {
+ if !icon.selected {
+ icon.selected = true;
+ changed.push(icon.id.clone());
+ }
+ }
+ for id in changed {
+ self.rebuild_icon_buffer(&id);
+ }
+ }
+
/// Starts a rubber-band selection at `pos` (global space) - clears
/// whatever was selected before, matching real desktop convention
/// (Windows/GNOME/macOS all start a fresh marquee selection, not an
@@ -603,6 +621,7 @@ impl CompState {
DesktopMenuAction::NewTextFile => self.new_desktop_text_file(),
DesktopMenuAction::OpenTerminalHere => self.open_terminal_here(),
DesktopMenuAction::OpenInFileManager => self.open_desktop_in_file_manager(),
+ DesktopMenuAction::SelectAll => self.select_all_desktop_icons(),
DesktopMenuAction::Refresh => self.refresh_desktop_icons(),
// Never actually reached - the click-dispatch site intercepts
// `Separator` first, same as `context_menu::MenuAction::