diff options
| author | srdusr <[email protected]> | 2025-08-15 23:22:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2025-08-15 23:22:00 +0200 |
| commit | cc22fe69a68e0fff027d833029aea850976488c8 (patch) | |
| tree | eb1350c24c61b5d4b30d763d64149a5c6504a925 /crates/core/src | |
| parent | 6694a2d9946d98d5752d84b22c45879cab5c9abe (diff) | |
| download | srdwm-cc22fe69a68e0fff027d833029aea850976488c8.tar.gz srdwm-cc22fe69a68e0fff027d833029aea850976488c8.zip | |
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.
Diffstat (limited to 'crates/core/src')
| -rw-r--r-- | crates/core/src/manager/mod.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/crates/core/src/manager/mod.rs b/crates/core/src/manager/mod.rs index 9593dd3..c2f67e4 100644 --- a/crates/core/src/manager/mod.rs +++ b/crates/core/src/manager/mod.rs @@ -206,6 +206,41 @@ pub struct WindowManager { /// without touching config - `udev::platform::connect` attempts the /// probe if *either* this or the env var says to. pub gpu_enabled: bool, + /// Whether srdwm draws real desktop icons (Home/Computer/Trash plus one + /// per real `~/Desktop` entry) on the primary output's wallpaper -- + /// read from `general.desktop_icons`. Unlike `gpu_enabled`, this + /// defaults to `true`: a directly user-requested, purely visual + /// feature with no hardware-support question to hedge against, not an + /// experimental backend path that needs an opt-in safety net. + pub desktop_icons_enabled: bool, + /// External program desktop icons open into, read from `general. + /// file_manager`. Empty (the default) means "shell out to `xdg-open + /// <path>`" - the de-facto standard dispatcher to whatever the user's + /// own `mimeapps.list` already names, present on essentially every + /// Linux/BSD desktop regardless of which file manager is installed. + /// Set means "shell out to `<file_manager> <path>` instead", the same + /// "user names a program, srdwm shells out to it" shape `general. + /// terminal`-style keybindings already use from Lua (`srd.spawn`), just + /// read from config instead of a keybinding script since desktop icons + /// have no Lua callback of their own to run. + pub file_manager: String, + /// Whether a single left-click opens a desktop icon instead of the + /// classic double-click, read from `general.desktop_icon_single_click`. + /// `false` (double-click) by default, matching Windows/macOS/most + /// Linux desktops' own default; some environments (older GNOME, some + /// file managers) default the other way, hence this being a real + /// config option rather than a hardcoded choice. + pub desktop_icon_single_click: bool, + /// External program a desktop image-file icon's "Set as Wallpaper" + /// action shells out to, read from `general.wallpaper_command`. Empty + /// (the default) means that action doesn't appear at all - srdwm + /// never draws the wallpaper itself (an external layer-shell client's + /// job, see `WaylandState`'s own doc comment on viewporter), so unlike + /// `file_manager`'s `xdg-open` fallback there is no universal command + /// to guess here; the user names their own wallpaper tool (`swww img`, + /// `awww img`, ...) or the action stays hidden rather than silently + /// doing nothing when clicked. + pub wallpaper_command: String, /// The whole-screen colour treatment currently active (night light's /// warm tint or reading mode's desaturation), live-settable via `srd /// set night_light`/`srd set reading_mode` - see [`ColorFilter`]. Off @@ -367,6 +402,10 @@ impl WindowManager { resize_margin: RESIZE_MARGIN, rounded_corners_enabled: None, gpu_enabled: false, + desktop_icons_enabled: true, + file_manager: String::new(), + desktop_icon_single_click: false, + wallpaper_command: String::new(), color_filter: ColorFilter::None, focus_follows_mouse: false, auto_raise: false, |