Conversation
Add a scratchpad in the spirit of i3: park the focused window off every virtual workspace with `move_to_scratchpad`, and summon or hide it with `toggle_scratchpad`. Toggle hides the focused scratchpad window, otherwise shows the least recently parked one on the current workspace (pulling a member that is visible elsewhere), and parks the focused window when the scratchpad is empty. A parked window keeps its floating flag but has no workspace assignment; the reactor moves it to the hidden screen corner like inactive-workspace windows. The first show after a tiled park sizes the window to 50% x 75% of the screen and centers it; later shows keep the geometry the user left. While a scratchpad window is visible, focus-follows-mouse does not raise other windows on that space, so it stays on top until clicked away or toggled. Cmd-Tab onto a parked window shows it instead of focusing it off-screen. Tiling the window removes it from the scratchpad. Membership is persisted with the layout file and pruned with the same rules as floating state. App rules accept `scratchpad = true` to park matching windows on launch (implies floating; rejected together with workspace, position, size, focus, or manage = false). rift-cli gains `execute window toggle-scratchpad` and `move-to-scratchpad`; rift.default.toml documents both.
Owner
|
im reviewing, this looks good so far |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an i3-style scratchpad (roadmap item "scratchpad windows/workspace").
Behaviour
move_to_scratchpad: park the focused window off every virtual workspace (i3move scratchpad). The window becomes floating.toggle_scratchpad(i3scratchpad show), in order:toggle_window_floating) removes it from the scratchpad; closing it does too.#[serde(default)], no schema bump) and is pruned with the same rules as floating state.scratchpad = trueparks matching windows as soon as they appear (implies floating). Validation rejects it together withworkspace,position,size,focus, ormanage = false, since none of them apply to a parked window.rift-cli execute window toggle-scratchpad | move-to-scratchpad.Design
A parked window is a floating window with no workspace assignment (the analogue of i3's
__i3_scratch), tracked in a smallScratchpadstruct owned byLayoutEngine(parked queue, shown set, "fresh" set). Because parked windows are unassigned, workspace queries and counts exclude them for free, and showing one is just assigning it to the active workspace as a normal floating window. No new visibility machinery: the reactor parks them in the hidden screen corner using the existingHiddenWindowPlacementgeometry inLayoutManager::calculate_layout.Guards for the "unassigned but managed" state sit at existing choke points rather than per caller:
LayoutEngine::is_window_in_active_workspacereturns false for parked windows (unassigned windows otherwise count as active).assign_window_with_app_info_policyreturns a newAppRuleResult::Unchangedfor parked windows, so discovery re-inventory, title-change reapply, and space activation cannot re-assign them. The check runs after persistence identity restore so a persisted parked window maps onto its live id first.add_window_to_layoutignores parked windows.window_hidden_from_active_workspace(renamed fromwindow_in_non_active_workspace) treats parked windows as hidden, so the existing post-discovery refocus handles a rule-parked window stealing focus on launch.This supersedes the approach in #233/#378 (separate manager,
hide_windowsside channel inEventResponse, duplicated hide geometry in the reactor).Tests
Scratchpad.cargo test --libon this branch: 599 passed, 1 failed. The failure,topology_change_clears_stale_pending_hide_target_before_next_workspace_layout, fails identically onmainwithout this change (macOS 15.6, this machine); happy to look into it separately if it is not known.Out of scope
Named scratchpads, per-rule scratchpad size/position, and a
scratchpadflag inrift-cli query windowsoutput. Easy follow-ups if wanted.