srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2025-08-15 23:22:00 +0200
committersrdusr <[email protected]>2025-08-15 23:22:00 +0200
commitcc22fe69a68e0fff027d833029aea850976488c8 (patch)
treeeb1350c24c61b5d4b30d763d64149a5c6504a925 /docs
parent6694a2d9946d98d5752d84b22c45879cab5c9abe (diff)
downloadsrdwm-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 'docs')
-rw-r--r--docs/DEFAULTS.md43
-rw-r--r--docs/TODO.md32
2 files changed, 73 insertions, 2 deletions
diff --git a/docs/DEFAULTS.md b/docs/DEFAULTS.md
index 7e712c5..5f99446 100644
--- a/docs/DEFAULTS.md
+++ b/docs/DEFAULTS.md
@@ -17,6 +17,10 @@ srd.set("general.rounded_corners", true) -- Default: true on GLES/
srd.set("general.focus_follows_mouse", false) -- Default: false - hover a window to focus it, no click needed
srd.set("general.auto_raise", false) -- Default: false - also raise on hover-focus, not just focus
srd.set("general.gpu", false) -- Default: false - udev backend only, see "GPU rendering" below
+srd.set("general.desktop_icons", true) -- Default: true - see "Desktop icons" below
+srd.set("general.file_manager", "") -- Default: "" - empty means dispatch via `xdg-open`
+srd.set("general.desktop_icon_single_click", false) -- Default: false - double-click opens an icon
+srd.set("general.wallpaper_command", "") -- Default: "" - empty hides "Set as Wallpaper" entirely
```
`general.smart_placement`/`general.border_width` are not listed: neither
is implemented - new-window placement always uses smart placement
@@ -54,6 +58,45 @@ separate, lower-level override for testing without touching config --
either it or `general.gpu` being set is enough to
attempt GPU rendering.
+#### Desktop icons (`general.desktop_icons`)
+
+Real, individually-draggable desktop icons rendered above the wallpaper
+and below every window, on the primary monitor only: fixed **Home**
+(`$HOME`), **Computer** (`/`), and **Trash** (`~/.local/share/Trash/files`,
+or `$XDG_DATA_HOME/Trash/files` if set) icons, plus one per real,
+non-hidden entry of `~/Desktop` (created if it doesn't exist yet). On by
+default - unlike `general.gpu`, this is a purely visual, directly
+requested feature with no hardware-support question to hedge against.
+
+Hand-drawn glyphs, not real icon-theme artwork - no PNG/SVG decoding
+capability exists anywhere in this codebase, so folder/computer/trash/file
+icons are simple flat shapes, the same technique the titlebar's own
+buttons use.
+
+Double-click (or a single click when `general.desktop_icon_single_click`
+is `true`) opens an icon: `$general.file_manager <path>` if that key is
+set, otherwise `xdg-open <path>`. Dragging an icon snaps it to the nearest
+free grid cell on release and persists that cell to
+`$XDG_STATE_HOME/srd/desktop-icons.json` (else `~/.local/state/srd/...`) --
+only icons the user has actually moved get an entry there; everything
+else keeps recomputing its default slot on every rescan.
+
+Right-click an icon: "Open", plus "Set as Wallpaper" when it's an image
+file (`.png`/`.jpg`/`.jpeg`/`.webp`/`.bmp`/`.gif`) and `general.
+wallpaper_command` is set - shells out to `<wallpaper_command> <path>`.
+srdwm never draws the wallpaper itself (an external layer-shell client's
+job - `swww`, `awww`, or similar), so there is no universal default to
+guess here the way `xdg-open` covers `file_manager`; this action simply
+doesn't appear when the key is empty. Right-click bare desktop: "New
+Folder" (creates `~/Desktop/New Folder`, de-duplicated as `New Folder
+(2)`, `(3)`, ...) and "Refresh" (re-scans `~/Desktop`).
+
+Not implemented in this first pass, deliberately: moving a file to trash,
+emptying the trash, filesystem watching (a file added to `~/Desktop` by
+another program needs "Refresh" or a restart to appear), multi-select,
+and per-mimetype icon art. The first two are destructive/hard-to-reverse
+actions with no confirmation-dialog primitive to gate them on yet.
+
### Monitor Settings (`monitor.*`)
```lua
srd.set("monitor.primary_layout", "dynamic") -- Default: "dynamic"
diff --git a/docs/TODO.md b/docs/TODO.md
index 4201375..1de3cee 100644
--- a/docs/TODO.md
+++ b/docs/TODO.md
@@ -13,6 +13,36 @@ that has the full story. Keep this list current as items close or open;
update the source doc's own entry too, don't let this drift into a
second stale copy the way `PANEL_SUPPORT_TODO.md` did.
+## Feature, implemented: real desktop icons plus the right-click desktop/icon menus (2026-08-25)
+
+Closes the "Right-click on bare desktop" item that used to sit under
+"Explicitly requested, not yet started" - previously a true no-op
+(`_ => {}` in `input/pointer.rs`'s button handler), nothing rendered above
+the wallpaper at all. Follow-up request, asked directly: real desktop
+icons "just like windows does" - Home/Computer/Trash plus one per real
+`~/Desktop` entry, draggable, right-click menus, a New Folder action, and
+(a later addition to the same round) a "Set as Wallpaper" action for
+image files.
+
+Built as the sibling of the existing `context_menu.rs`/`snap_flyout.rs`
+"compositor-owned floating UI" pattern - see `desktop_icons.rs`'s and
+`desktop_menu.rs`'s own module doc comments for the full architecture.
+Four new config keys (`general.desktop_icons`, default `true`;
+`general.file_manager`, `general.desktop_icon_single_click`, `general.
+wallpaper_command`, all default off/empty) - see DEFAULTS.md's own
+"Desktop icons" section for the complete behavior writeup.
+
+Deliberately cut from this pass, stated up front rather than discovered
+later: no move-to-trash and no "Empty Trash" (both destructive/hard-to-
+reverse with no confirmation-dialog primitive to gate them on yet), no
+filesystem watching (manual "Refresh" or a restart picks up an externally
+added file), no multi-select, no per-mimetype icon art, icons on the
+primary monitor only.
+
+Built, `cargo test --workspace` (124 wayland-crate tests, up from 106) and
+`cargo clippy --workspace --all-targets` clean; installed, pending a live
+restart to confirm.
+
## Real bug, root-caused and fixed: a resize's own rapid-fire commits could get a window's rounded-corner content mask cached as blank, hiding real content until the next real content change (2026-08-25)
Reported live: "terminal output/everything disappears when i sometimes resize terminal." `general.rounded_corners = true` in this machine's own live config, so the udev/Pixman content-masking path (`rounded_corners_pixman.rs`) is what's actually in play, not just a rarely-hit opt-in.
@@ -1527,8 +1557,6 @@ persists.
environment to confirm live. Needs an actual physical click test.
## Explicitly requested, not yet started
-- [ ] **Right-click on bare desktop** - no handler exists at all
- currently; requested, scope/design never discussed.
- [ ] **Window-management-policy comparison vs. GlazeWM, Awesome,
Openbox, RagnarWM** - all four cloned to `~/reference-wms/` and
ready; the *rendering* comparison used niri and mutter (the only