Make hot corners configurable, including per-output (#2108)

* Add corner selection in config

* Add hot corner docs

* Working per-monitor hot corners

Handle defaults

* run cargo fmt --all

* Fix hot corners in is_sticky_obscured_under

* Change default to fall back to gesture hot corners if output hot corners are unset

* Add hot corner output config docs

* Support fractional scaling

* Trigger hot corners over widgets

* Improve float handling
Fixed YaLTeR/niri/pull/2108

* Refactor

* Bug Fixes

* Amend docs

Fix styling

Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>

* Integrate code review

Move is_inside_hot_corner

* fixes

---------

Co-authored-by: Aadniz <8147434+Aadniz@users.noreply.github.com>
Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
This commit is contained in:
Kai Koehler
2025-09-16 08:10:01 -07:00
committed by GitHub
parent bffc5c1377
commit 08f5c6fecb
6 changed files with 135 additions and 13 deletions
+8
View File
@@ -54,4 +54,12 @@ impl Default for DndEdgeWorkspaceSwitch {
pub struct HotCorners {
#[knuffel(child)]
pub off: bool,
#[knuffel(child)]
pub top_left: bool,
#[knuffel(child)]
pub top_right: bool,
#[knuffel(child)]
pub bottom_left: bool,
#[knuffel(child)]
pub bottom_right: bool,
}
+20
View File
@@ -348,6 +348,13 @@ mod tests {
mode "1920x1080@144"
variable-refresh-rate on-demand=true
background-color "rgba(25, 25, 102, 1.0)"
hot-corners {
off
top-left
top-right
bottom-left
bottom-right
}
}
layout {
@@ -742,6 +749,15 @@ mod tests {
},
),
backdrop_color: None,
hot_corners: Some(
HotCorners {
off: true,
top_left: true,
top_right: true,
bottom_left: true,
bottom_right: true,
},
),
},
],
),
@@ -1158,6 +1174,10 @@ mod tests {
},
hot_corners: HotCorners {
off: false,
top_left: false,
top_right: false,
bottom_left: false,
bottom_right: false,
},
},
overview: Overview {
+4
View File
@@ -1,5 +1,6 @@
use niri_ipc::{ConfiguredMode, Transform};
use crate::gestures::HotCorners;
use crate::{Color, FloatOrInt};
#[derive(Debug, Default, Clone, PartialEq)]
@@ -27,6 +28,8 @@ pub struct Output {
pub background_color: Option<Color>,
#[knuffel(child)]
pub backdrop_color: Option<Color>,
#[knuffel(child)]
pub hot_corners: Option<HotCorners>,
}
impl Output {
@@ -56,6 +59,7 @@ impl Default for Output {
variable_refresh_rate: None,
background_color: None,
backdrop_color: None,
hot_corners: None,
}
}
}