diff options
| author | srdusr <[email protected]> | 2026-04-27 00:18:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2026-04-27 00:18:00 +0200 |
| commit | c4dc99cc3211c4dc1a461f228402be1593b883c9 (patch) | |
| tree | 10a85d60acb863ca98b7e70118dec5cda357efa6 /crates/core/src/manager/windows.rs | |
| parent | 436d42da6ef61a5ea20d5102c4baed7bf0993606 (diff) | |
| download | srdwm-c4dc99cc3211c4dc1a461f228402be1593b883c9.tar.gz srdwm-c4dc99cc3211c4dc1a461f228402be1593b883c9.zip | |
Build the eight asks recovered from the previous session's transcript
The punch list was not the whole record. These are the owner's own typed
requests, read back out of the previous session's transcript rather than
guessed at, then each checked against the code before being treated as open.
Three they suspected were already done really were: dialogs already had a
Close-only titlebar, inactive dimming already existed, and the corner resize
hitbox had already been tuned.
Snap layouts on drag, asked for twice. Edge snapping worked but committed
silently on release with nothing shown first, so there was no way to know it
would happen or where. A translucent drop-target preview now follows the
drag, and throwing the pointer at a monitor's top edge drops down the
existing six-cell grid to aim at. The preview calls the same snap_zone that
end_drag does, so the two cannot disagree. Two defects found by screenshot
before landing: moving down onto the flyout closed it, and its labels
overflowed at a fixed cell width - the same "text goes out of view" fault
already fixed once for the context menu.
New File now offers real types, chosen by extension, with the de-duplication
counter placed before the extension so the file stays what it says it is.
Refresh re-reads init.lua and fires a new srd.on("refresh") handler instead
of only re-scanning the icon grid. What refresh means beyond srdwm's own
config stays the config's decision.
general.config_reload_on_write (default on) applies an edited config on save,
via an mtime sweep rather than an inotify watch: no new dependency, same
behaviour on every target, and unaffected by editors that write through a
temp file.
A real bug behind "what happens when our config fails": you lost every
keybinding. do_reload cleared the binding, handler and repeat tables before
re-executing and never restored them, so a syntax error left neither the old
config nor the new one, and the only key still working was the reload combo
nobody thinks to press. The tables are now restored on any failure and
config errors reach notify-send, not just the log.
srd.lock() and a default Mod4+Ctrl+l binding: the built-in lock screen could
not be reached from Lua at all. Native rather than shelling out, because a
lock key that shells out fails silently when the binary is not on PATH.
Default bindings added for srd.window.move and a dynamic/tiling toggle, both
of which existed with no way to reach them, plus srd.layout.get() so the
toggle reads the live workspace rather than the configured default.
Dialogs open centred, and are excluded from remembered geometry in both
directions - that table is keyed by app_id, which a dialog shares with the
window that spawned it, so dialogs inherited an unrelated position and size
and then overwrote it with their own.
theme.decorations.title_bar.button_mode (dynamic by default, or fixed) drops
the Maximize button on a window whose client pinned min == max size, where
pressing it can do nothing. Maximize is removed from the slot list rather
than skipped in place on both the render and hit-test sides, so the remaining
buttons close the gap identically; three tests pin that agreement, which is
what fails silently when it drifts.
Also: the nested backend's screencopy pass now draws both menus, the flyout
and the drag preview. Four investigations in one day started from a
screenshot missing a tier, so that pass carries an explicit list of what it
still omits and the on-screen loop points at it.
512 tests pass, clippy clean.
Diffstat (limited to 'crates/core/src/manager/windows.rs')
| -rw-r--r-- | crates/core/src/manager/windows.rs | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/crates/core/src/manager/windows.rs b/crates/core/src/manager/windows.rs index 3271dee..bd13b0c 100644 --- a/crates/core/src/manager/windows.rs +++ b/crates/core/src/manager/windows.rs @@ -77,8 +77,15 @@ impl WindowManager { // question from size: a size is always safe to reapply verbatim, // but a *position* needs checking against the monitors that // actually exist right now before it's safe to reuse. + // + // Skipped entirely for a dialog: `remembered_geometry` is keyed by + // `app_id`, which a dialog shares with the ordinary window that + // spawned it, so reapplying that entry would resize a small + // confirmation prompt to the size of the app's main window. Its + // own requested size is the right one. See the dialog branch + // further down for the matching position half. let mut remembered_position: Option<(i32, i32)> = None; - if !window.app_id.is_empty() { + if !window.app_id.is_empty() && !window.is_dialog { if let Some((x, y, w, h)) = self.remembered_geometry.get(&window.app_id).copied() { window.geometry.width = w.max(MIN_WINDOW_WIDTH); window.geometry.height = h.max(MIN_WINDOW_HEIGHT); @@ -131,7 +138,27 @@ impl WindowManager { // shrunk usable one): a remembered position under where a bar now // sits is still "a real monitor, just partly covered", not invalid. let remembered_monitor = remembered_position.and_then(|(x, y)| self.monitors.iter().find(|m| m.full_geometry.contains_point(x, y))); - if let (Some((x, y)), Some(monitor)) = (remembered_position, remembered_monitor) { + // A dialog is centred, and neither cascaded nor restored to a + // remembered spot. Reported as "even dialog/starter windows spawn + // that side, most times should be centered". + // + // Ahead of the remembered-position branch on purpose: `remembered_ + // geometry` is keyed by `app_id`, which a dialog shares with the + // ordinary window that spawned it, so a dialog would otherwise be + // dropped at wherever that app's last *main* window happened to + // sit - and would then overwrite that memory with its own small + // rect on close. Centring is also what every mainstream desktop + // does with a transient: the user's attention is already at the + // middle of the screen, not at a cascade origin. + // + // `geometry`, not `full_geometry`: a dialog centred in the usable + // area sits clear of a bar or dock, which is where a modal belongs. + if window.is_dialog { + if let Some(monitor) = target_monitor { + window.monitor = monitor.id; + window.geometry = centered_in(monitor.geometry, window.geometry.width, window.geometry.height); + } + } else if let (Some((x, y)), Some(monitor)) = (remembered_position, remembered_monitor) { window.monitor = monitor.id; window.geometry.x = x; window.geometry.y = y; |