Skip to content

Add hot_corners#181

Open
rywby-dot wants to merge 11 commits into
malbiruk:mainfrom
rywby-dot:hot-corners
Open

Add hot_corners#181
rywby-dot wants to merge 11 commits into
malbiruk:mainfrom
rywby-dot:hot-corners

Conversation

@rywby-dot

Copy link
Copy Markdown
Contributor

Like from niri, but more functional

Setup only per output
Support any actions from keybindings, every corner is independent

[outputs.hot_corners]                                                                                                                                
threshold = 4         # activation radius in logical px (default: 4)                                                                                 
top_left = "zoom-to-fit"                                                                                                                             
top_right = "none"                                                                                                                                   
bottom_left = "spawn grim - | wl-copy"                                                                                                               
bottom_right = "exec-launcher"                                                                                                                       
disable_when_fullscreen = true                                
disable_while_dragging  = true
hot-corners.mp4

@malbiruk malbiruk left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this — nice feature, and the config/docs wiring is clean. One must-fix (inline on pointer.rs, it silently disables the whole feature) plus two smaller cleanups, all left inline.

Minor nit not worth a thread: the disable_when_fullscreen early-return doesn't clear hot_corners_armed, so a corner won't re-fire after fullscreen-exit until the cursor leaves and re-enters.

Comment thread src/input/pointer.rs
let button = event.button_code();
let button_state = event.state();
if button_state == ButtonState::Pressed {
self.held_buttons.insert(button);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must-fix: held_buttons has no reset path, unlike its sibling suppressed_keys (cleared on VT-switch in keyboard.rs and on PauseSession in udev.rs). Hold a mouse button across a VT switch / suspend and the release is lost → held_buttons stays non-empty → with the default disable_while_dragging = true, every hot corner is dead for the rest of the session. Please clear it at those same two sites.

(Moving this insert/remove above the outputs().is_none() early-return further up also closes the transient output-hotplug variant.)

Comment thread src/input/mod.rs
output: &smithay::output::Output,
screen_pos: Point<f64, smithay::utils::Logical>,
) {
let Some(cfg) = self.config.output_config(&output.name()).cloned() else {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This .cloned() runs on every pointer-motion event for any output with an [[outputs]] block, and OutputConfig.name is a String — so it heap-allocates per event even when no corners are configured. Check bindings.is_empty() on the borrowed ref first, and clone only the fired Action.

Comment thread config.reference.toml
# # synthesizing a CVT modeline when the monitor doesn't advertise it (intended
# # for CRTs or forcing non-standard modes; may be rejected by some panels).
# #
# ## Hot-corners: bind any keyboard action to a screen corner. The action fires

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

## renders as an <h2> in the generated docs/config.md, splitting this sentence across the heading and the next paragraph. Use # # prose like the surrounding blocks, then regen: UPDATE_CONFIG_DOCS=1 cargo test docs_config_md_is_up_to_date.

@malbiruk malbiruk force-pushed the main branch 2 times, most recently from 5663fc2 to dea3d12 Compare July 10, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants