From c2b39b6906aac09fefd62f9e4b9b8ced21a219f5 Mon Sep 17 00:00:00 2001 From: webbeef Date: Tue, 17 Feb 2026 17:43:23 -0800 Subject: [PATCH] system: improve edge gestures management --- ui/system/edge_gesture_handler.js | 15 +++++++++ ui/system/mobile.css | 2 +- ui/system/mobile_action_bar.js | 7 ++++- ui/system/mobile_layout_manager.js | 42 ++++++++++++++++++++++++++ ui/system/mobile_notification_sheet.js | 15 ++++++++- 5 files changed, 78 insertions(+), 3 deletions(-) diff --git a/ui/system/edge_gesture_handler.js b/ui/system/edge_gesture_handler.js index ae0b85e..e0aad88 100644 --- a/ui/system/edge_gesture_handler.js +++ b/ui/system/edge_gesture_handler.js @@ -332,4 +332,19 @@ export class EdgeGestureHandler { this.peekPreview.style.transform = ""; } } + + // Enable or disable specific edge overlays + // edges: object with left, right, bottom, top boolean properties + setEdgesEnabled(edges) { + for (const [edge, enabled] of Object.entries(edges)) { + const overlay = this.edgeOverlays[edge]; + if (overlay) { + if (edge === "left" || edge === "right") { + overlay.style.width = enabled ? `${this.edgeThreshold}px` : "0"; + } else { + overlay.style.height = enabled ? `${this.edgeThreshold}px` : "0"; + } + } + } + } } diff --git a/ui/system/mobile.css b/ui/system/mobile.css index b495add..ff4d4e1 100644 --- a/ui/system/mobile.css +++ b/ui/system/mobile.css @@ -296,7 +296,7 @@ body.mobile-mode .mobile-webview-container.slide-out-right { touch-action: none; pointer-events: auto; background: transparent; - /* rgba(77, 215, 220, 0.49); */ + /* background: rgba(77, 215, 220, 0.49); */ } /* Expand edge overlay to full screen during active gesture, diff --git a/ui/system/mobile_action_bar.js b/ui/system/mobile_action_bar.js index 00d6c74..955217c 100644 --- a/ui/system/mobile_action_bar.js +++ b/ui/system/mobile_action_bar.js @@ -56,6 +56,9 @@ export class MobileActionBar extends LitElement { show() { this.updateState(); this.open = true; + this.dispatchEvent( + new CustomEvent("action-bar-opened", { bubbles: true, composed: true }), + ); } hide() { @@ -63,6 +66,9 @@ export class MobileActionBar extends LitElement { this.results = []; this.groups = []; this.searchController.clear(); + this.dispatchEvent( + new CustomEvent("action-bar-closed", { bubbles: true, composed: true }), + ); } toggle() { @@ -167,7 +173,6 @@ export class MobileActionBar extends LitElement { if (this.layoutManager) { this.layoutManager.reload(); } - this.hide(); } handleViews() { diff --git a/ui/system/mobile_layout_manager.js b/ui/system/mobile_layout_manager.js index 916ad20..61b45aa 100644 --- a/ui/system/mobile_layout_manager.js +++ b/ui/system/mobile_layout_manager.js @@ -47,6 +47,41 @@ export class MobileLayoutManager { this.actionBar.updateState(); } }); + + // Disable all edges when action bar or notification sheet opens + document.addEventListener("action-bar-opened", () => { + this.disableAllEdges(); + }); + document.addEventListener("action-bar-closed", () => { + this.restoreEdges(); + }); + document.addEventListener("sheet-opened", () => { + this.disableAllEdges(); + }); + document.addEventListener("sheet-closed", () => { + this.restoreEdges(); + }); + } + + // Disable all edge gestures (when overlay UI is open) + disableAllEdges() { + this.gestureHandler.setEdgesEnabled({ + left: false, + right: false, + bottom: false, + top: false, + }); + } + + // Restore edge gestures based on current state + restoreEdges() { + const onHomescreen = this.isHomescreen(this.activeWebviewId); + this.gestureHandler.setEdgesEnabled({ + left: !onHomescreen, + right: !onHomescreen, + bottom: !onHomescreen, + top: true, + }); } generateId() { @@ -56,6 +91,10 @@ export class MobileLayoutManager { // Set the homescreen webview setHomescreen(webviewId) { this.homescreenWebviewId = webviewId; + // Update edge gestures if homescreen is currently active + if (this.activeWebviewId === webviewId) { + this.restoreEdges(); + } } // Check if a webview is the homescreen @@ -178,6 +217,9 @@ export class MobileLayoutManager { container.classList.add("active"); } } + + // Update edge gesture areas based on whether we're on the homescreen + this.restoreEdges(); } // Switch to webview at given index diff --git a/ui/system/mobile_notification_sheet.js b/ui/system/mobile_notification_sheet.js index c5df28b..30d6677 100644 --- a/ui/system/mobile_notification_sheet.js +++ b/ui/system/mobile_notification_sheet.js @@ -57,7 +57,20 @@ export class MobileNotificationSheet extends LitElement { close() { this.open = false; - this.dispatchEvent(new CustomEvent("sheet-closed", { bubbles: true })); + } + + updated(changedProperties) { + if (changedProperties.has("open")) { + if (this.open) { + this.dispatchEvent( + new CustomEvent("sheet-opened", { bubbles: true, composed: true }), + ); + } else { + this.dispatchEvent( + new CustomEvent("sheet-closed", { bubbles: true, composed: true }), + ); + } + } } handleNotificationClick(notification) { -- 2.51.2