From cc22fe69a68e0fff027d833029aea850976488c8 Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Fri, 15 Aug 2025 23:22:00 +0200 Subject: Add real desktop icons plus right-click desktop/icon context menus Closes "right-click on bare desktop" - previously a true no-op, nothing rendered above the wallpaper at all. Requested directly: a real desktop "just like windows does" - Home/Computer/Trash plus one icon per real ~/Desktop entry, individually draggable with persisted grid positions, double-click to open, right-click menus (per-icon "Open" plus "Set as Wallpaper" for image files when general.wallpaper_command is set; bare desktop "New Folder"/"Refresh"). Architecture mirrors the existing context_menu.rs/snap_flyout.rs "compositor-owned floating UI" pattern: desktop_icons.rs (data model, grid layout, filesystem scan, hit-test), desktop_icons_state.rs (JSON persistence, same shape as monitor_layout.rs), desktop_menu.rs (the new right-click menu, reusing decoration::render_context_menu's existing rasterizer), state/desktop_icons.rs (CompState glue: rescan/select/drag/ open/persist), and a new decoration::render_desktop_icon rasterizer -- hand-drawn glyphs, since no PNG/SVG decoding capability exists anywhere in this workspace. Wired into both render loops (udev and winit) above the wallpaper and below every window, and into input/pointer.rs's button/ motion handlers for selection, drag, double-click, and both menus. Four new config keys: general.desktop_icons (default true - a directly requested, purely visual feature, unlike the opt-in-while-experimental general.gpu), general.file_manager, general.desktop_icon_single_click, general.wallpaper_command (all default off/empty). Deliberately out of scope for this pass, stated up front: move-to-trash and "Empty Trash" (destructive, no confirmation-dialog primitive to gate them on yet), filesystem watching, multi-select, per-mimetype icon art, icons on any monitor but the primary one. 124 wayland-crate tests (up from 106), full workspace build and clippy clean. --- crates/config/src/engine/support.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'crates/config/src/engine') diff --git a/crates/config/src/engine/support.rs b/crates/config/src/engine/support.rs index 9f7e537..76fbe62 100644 --- a/crates/config/src/engine/support.rs +++ b/crates/config/src/engine/support.rs @@ -154,6 +154,22 @@ pub(super) fn default_config() -> HashMap { // every other ordinary flag rather than left absent for a backend to // decide. set("general.gpu", Bool(false)); + // Real desktop icons (Home/Computer/Trash plus `~/Desktop`'s own + // contents) on by default - see `WindowManager::desktop_icons_ + // enabled`'s own doc comment for why this, unlike `general.gpu` just + // above, doesn't need an opt-in safety net. + set("general.desktop_icons", Bool(true)); + // Empty by default - see `WindowManager::file_manager`'s own doc + // comment: empty means "dispatch via `xdg-open`", not "no file manager + // configured, do nothing". + set("general.file_manager", String(std::string::String::new())); + // Double-click by default - see `WindowManager::desktop_icon_single_ + // click`'s own doc comment. + set("general.desktop_icon_single_click", Bool(false)); + // Empty by default - see `WindowManager::wallpaper_command`'s own doc + // comment: empty means "Set as Wallpaper" doesn't appear at all, not + // "configured to do nothing". + set("general.wallpaper_command", String(std::string::String::new())); // Deliberately *not* seeded here, unlike every other `general.*` key -- // its actual default differs by backend (GLES/winit: on; udev/Pixman: // off, an untested-on-real-hardware CPU cost too real to default to on -- cgit v1.2.3