From a6c17548493463ee4a079cf78b602584dc6e45bf Mon Sep 17 00:00:00 2001 From: Litesung Date: Tue, 27 Jan 2026 11:04:34 -0800 Subject: [PATCH] feat(notch): add four-finger gesture support for overview/dashboard Add gesture_up() and gesture_down() methods for touchpad gesture integration: - Swipe up: opens overview if nothing open, closes dashboard if open - Swipe down: opens dashboard if nothing open, closes overview if open Uses _current_widget tracking to determine which panel is currently open, enabling intuitive bidirectional gesture navigation. Example libinput-gestures config: gesture swipe up 4 fabric-cli exec ax-shell 'notch.gesture_up()' gesture swipe down 4 fabric-cli exec ax-shell 'notch.gesture_down()' Co-Authored-By: Claude Opus 4.5 --- modules/notch.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/modules/notch.py b/modules/notch.py index 10ded5b5..e5a370c9 100644 --- a/modules/notch.py +++ b/modules/notch.py @@ -433,6 +433,7 @@ def __init__(self, monitor_id: int = 0, **kwargs): ) self._is_notch_open = False + self._current_widget = None self._scrolling = False if data.VERTICAL: @@ -833,6 +834,7 @@ def close_notch(self): self.bar.revealer_left.set_reveal_child(True) self.applet_stack.set_visible_child(self.nhistory) self._is_notch_open = False + self._current_widget = None self.stack.set_visible_child(self.compact) if data.PANEL_THEME != "Notch": self.notch_revealer.set_reveal_child(False) @@ -845,6 +847,20 @@ def close_notch(self): else: self.set_margin("-40px 8px 8px 8px") + def gesture_up(self): + """Four-finger swipe up: close dashboard if open, otherwise open overview.""" + if self._is_notch_open and self._current_widget == "dashboard": + self.close_notch() + elif not self._is_notch_open: + self.show_notch("overview") + + def gesture_down(self): + """Four-finger swipe down: close overview if open, otherwise open dashboard.""" + if self._is_notch_open and self._current_widget == "overview": + self.close_notch() + elif not self._is_notch_open: + self.show_notch("dashboard") + def open_notch(self, widget_name: str): # Debug info for troubleshooting if hasattr(self, '_debug_monitor_focus') and self._debug_monitor_focus: @@ -1059,8 +1075,15 @@ def _open_notch_internal(self, widget_name: str): if self.bar and not self.bar.get_visible() and data.BAR_POSITION == "Top": self.set_margin("0px 8px 8px 8px") - + self._is_notch_open = True + # Track current widget for gesture handlers + if target_widget_on_stack == self.overview: + self._current_widget = "overview" + elif target_widget_on_stack == self.dashboard: + self._current_widget = "dashboard" + else: + self._current_widget = widget_name def toggle_hidden(self): self.hidden = not self.hidden