aboutsummaryrefslogtreecommitdiff
path: root/src/niri.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-04-25 10:08:26 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-04-25 02:00:18 -0700
commite6d82d3ee34a7ac225d07ca3f4f4365cf27292d1 (patch)
tree36880baab7b89832ced2f38ab79e8b93b6cac687 /src/niri.rs
parentfae3a276418ef1f6f6baad465f160e33a6ac9d8a (diff)
downloadniri-e6d82d3ee34a7ac225d07ca3f4f4365cf27292d1.tar.gz
niri-e6d82d3ee34a7ac225d07ca3f4f4365cf27292d1.tar.bz2
niri-e6d82d3ee34a7ac225d07ca3f4f4365cf27292d1.zip
Implement top-left hot corner to toggle the Overview
Compared to third-party implementations such as waycorner: - It works during interactive window move (no surfaces receive pointer focus in this case, so this cannot work through layer-shell). - It works during drag-and-drop. - It disables itself over fullscreen windows. - It does not prevent direct scanout.
Diffstat (limited to 'src/niri.rs')
-rw-r--r--src/niri.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/niri.rs b/src/niri.rs
index 225a3702..fd317f2b 100644
--- a/src/niri.rs
+++ b/src/niri.rs
@@ -347,6 +347,7 @@ pub struct Niri {
/// Used for limiting the notify to once per iteration, so that it's not spammed with high
/// resolution mice.
pub notified_activity_this_iteration: bool,
+ pub pointer_inside_hot_corner: bool,
pub tablet_cursor_location: Option<Point<f64, Logical>>,
pub gesture_swipe_3f_cumulative: Option<(f64, f64)>,
pub overview_scroll_swipe_gesture: ScrollSwipeGesture,
@@ -2427,6 +2428,7 @@ impl Niri {
pointer_inactivity_timer: None,
pointer_inactivity_timer_got_reset: false,
notified_activity_this_iteration: false,
+ pointer_inside_hot_corner: false,
tablet_cursor_location: None,
gesture_swipe_3f_cumulative: None,
overview_scroll_swipe_gesture: ScrollSwipeGesture::new(),
@@ -2920,6 +2922,11 @@ impl Niri {
return false;
}
+ let hot_corner = Rectangle::from_size(Size::from((1., 1.)));
+ if hot_corner.contains(pos_within_output) {
+ return true;
+ }
+
if layer_popup_under(Layer::Top) || layer_toplevel_under(Layer::Top) {
return true;
}
@@ -3175,6 +3182,11 @@ impl Niri {
.or_else(|| layer_toplevel_under(Layer::Bottom))
.or_else(|| layer_toplevel_under(Layer::Background));
} else {
+ let hot_corner = Rectangle::from_size(Size::from((1., 1.)));
+ if hot_corner.contains(pos_within_output) {
+ return rv;
+ }
+
under = under
.or_else(|| layer_popup_under(Layer::Top))
.or_else(|| layer_toplevel_under(Layer::Top));