diff options
| author | srdusr <[email protected]> | 2025-08-17 01:54:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2025-08-17 01:54:00 +0200 |
| commit | b8376bd631a72f7484c24663699a7d4c813f600e (patch) | |
| tree | c8c84725e3c66598df3f619dd96aa69b6eede26e /crates/wayland/src/input | |
| parent | bd6aadf4d166c05f22f1ab6cdfe2e815e071f162 (diff) | |
| download | srdwm-b8376bd631a72f7484c24663699a7d4c813f600e.tar.gz srdwm-b8376bd631a72f7484c24663699a7d4c813f600e.zip | |
Fix desktop icons v1 regressions: bar overlap, wrong order; add proper menus
Live testing found v1 genuinely broken, not just rough:
1. Icons weren't rendering reliably at all - ensure_desktop_icons only
ever computed the grid's origin once, on whichever render pass
happened to be first. AGS's own top bar registers its exclusive zone
after that first pass, so origin got permanently baked in at the
pre-bar geometry. Confirmed live via a temporary diagnostic log.
Fixed by re-deriving origin from the primary monitor's current
geometry on every call instead of just the first.
2. Fixed icons (Home/Computer/Trash) always sorted before real files --
confirmed wrong via direct question. The whole list now sorts
alphabetically by label, case-insensitive, fixed icons included.
3. "Set as Wallpaper" was the wrong feature: removed entirely
(DesktopMenuAction::SetWallpaper, general.wallpaper_command,
is_image_path). The user wants that handled by their real file
manager once opened, not reimplemented here.
Also adds real menu functionality per "where are all the options":
Rename (inline text edit, new CompState::renaming_icon field and
keyboard redirect mirroring NativeLock::password's existing precedent),
Delete (moves to ~/.local/share/Trash per the freedesktop.org spec, new
trash.rs module, same-filesystem case, no confirmation - this is the
reversible move-to-trash, not a permanent delete), Empty Trash on the
Trash icon, and Open Terminal Here / Open in File Manager on the
bare-desktop menu (new general.terminal config key).
133 wayland-crate tests (up from 106), full workspace build and clippy
clean.
Diffstat (limited to 'crates/wayland/src/input')
| -rw-r--r-- | crates/wayland/src/input/keyboard.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/wayland/src/input/keyboard.rs b/crates/wayland/src/input/keyboard.rs index ae367f4..f1b117f 100644 --- a/crates/wayland/src/input/keyboard.rs +++ b/crates/wayland/src/input/keyboard.rs @@ -65,6 +65,25 @@ pub(crate) fn handle_keyboard_key_event<B: smithay::backend::input::InputBackend return; } + // An in-progress desktop-icon rename claims every keystroke the same + // way the native lock's password entry does just above - see + // `CompState::renaming_icon`'s own doc comment. Not gated by `state. + // lock.locked` (already excluded, since that branch already returned) + // - this only ever runs during ordinary, unlocked interactive use. + if state.renaming_icon.is_some() { + if key_state == BackendKeyState::Pressed { + keyboard.input::<(), _>(state, keycode, key_state, serial, time, |data, _mods, handle| { + let utf8 = xkbcommon::xkb::keysym_to_utf8(handle.modified_sym()); + let name = keysym_name_for(handle).unwrap_or_default(); + data.desktop_icon_rename_key(&name, &utf8); + FilterResult::Intercept(()) + }); + } else { + keyboard.input::<(), _>(state, keycode, key_state, serial, time, |_, _, _| FilterResult::Intercept(())); + } + return; + } + let bound_keys = state.bound_keys.clone(); let matched: Option<(String, Modifiers)> = keyboard.input(state, keycode, key_state, serial, time, move |data, mods, handle| { |