From 4e33f4552226fbadb156ca16b483cda10d04b433 Mon Sep 17 00:00:00 2001 From: bbb651 Date: Fri, 13 Dec 2024 02:40:36 +0200 Subject: Add `Mouse{Left,Right,Middle,Back,Forward}` binds --- src/niri.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/niri.rs') diff --git a/src/niri.rs b/src/niri.rs index 7d81bbc6..ada6039e 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -116,7 +116,8 @@ use crate::frame_clock::FrameClock; use crate::handlers::{configure_lock_surface, XDG_ACTIVATION_TOKEN_TIMEOUT}; use crate::input::scroll_tracker::ScrollTracker; use crate::input::{ - apply_libinput_settings, mods_with_finger_scroll_binds, mods_with_wheel_binds, TabletData, + apply_libinput_settings, mods_with_finger_scroll_binds, mods_with_mouse_binds, + mods_with_wheel_binds, TabletData, }; use crate::ipc::server::IpcServer; use crate::layer::mapped::LayerSurfaceRenderElement; @@ -277,6 +278,8 @@ pub struct Niri { pub seat: Seat, /// Scancodes of the keys to suppress. pub suppressed_keys: HashSet, + /// Button codes of the mouse buttons to suppress. + pub suppressed_buttons: HashSet, pub bind_cooldown_timers: HashMap, pub bind_repeat_timer: Option, pub keyboard_focus: KeyboardFocus, @@ -313,6 +316,7 @@ pub struct Niri { pub gesture_swipe_3f_cumulative: Option<(f64, f64)>, pub vertical_wheel_tracker: ScrollTracker, pub horizontal_wheel_tracker: ScrollTracker, + pub mods_with_mouse_binds: HashSet, pub mods_with_wheel_binds: HashSet, pub vertical_finger_scroll_tracker: ScrollTracker, pub horizontal_finger_scroll_tracker: ScrollTracker, @@ -1142,6 +1146,8 @@ impl State { if config.binds != old_config.binds { self.niri.hotkey_overlay.on_hotkey_config_updated(); + self.niri.mods_with_mouse_binds = + mods_with_mouse_binds(self.backend.mod_key(), &config.binds); self.niri.mods_with_wheel_binds = mods_with_wheel_binds(self.backend.mod_key(), &config.binds); self.niri.mods_with_finger_scroll_binds = @@ -1846,6 +1852,7 @@ impl Niri { let cursor_manager = CursorManager::new(&config_.cursor.xcursor_theme, config_.cursor.xcursor_size); + let mods_with_mouse_binds = mods_with_mouse_binds(backend.mod_key(), &config_.binds); let mods_with_wheel_binds = mods_with_wheel_binds(backend.mod_key(), &config_.binds); let mods_with_finger_scroll_binds = mods_with_finger_scroll_binds(backend.mod_key(), &config_.binds); @@ -1998,6 +2005,7 @@ impl Niri { popups: PopupManager::default(), popup_grab: None, suppressed_keys: HashSet::new(), + suppressed_buttons: HashSet::new(), bind_cooldown_timers: HashMap::new(), bind_repeat_timer: Option::default(), presentation_state, @@ -2025,6 +2033,7 @@ impl Niri { gesture_swipe_3f_cumulative: None, vertical_wheel_tracker: ScrollTracker::new(120), horizontal_wheel_tracker: ScrollTracker::new(120), + mods_with_mouse_binds, mods_with_wheel_binds, // 10 is copied from Clutter: DISCRETE_SCROLL_STEP. -- cgit