From 9f49f74c3b992b05102f0c8d9bef4b511c69ebad Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sat, 27 Sep 2025 23:13:30 -0400 Subject: [PATCH] Workaround preview menu closing on context menu sync_hover not working on g-s 49 https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8684 --- src/windowPreview.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/windowPreview.js b/src/windowPreview.js index fbe69c0..440b4d3 100644 --- a/src/windowPreview.js +++ b/src/windowPreview.js @@ -418,7 +418,7 @@ export const PreviewMenu = GObject.registerClass( _onHoverChanged() { this._endOpenCloseTimeouts() - if (this.currentAppIcon && !this.menu.hover) { + if (this.currentAppIcon && !this.menu.hover && !this.hasGrab) { this._addCloseTimeout() this._endPeek() } @@ -1131,6 +1131,8 @@ export const Preview = GObject.registerClass( this._previewMenu.peekInitialWorkspaceIndex, ) + this._previewMenu.hasGrab = true + Main.wm._showWindowMenu(null, this.window, Meta.WindowMenuType.WM, { x: coords[0], y: coords[1], @@ -1140,10 +1142,13 @@ export const Preview = GObject.registerClass( let menu = Main.wm._windowMenuManager._manager._menus[0] - menu.connect('open-state-changed', () => - this._previewMenu.menu.sync_hover(), - ) - this._previewMenu.menu.sync_hover() + menu.connect('open-state-changed', (menu, opened) => { + if (!opened) { + delete this._previewMenu.hasGrab + + if (!this._previewMenu.menu.hover) this._previewMenu.close() + } + }) if (this.window.get_workspace() != currentWorkspace) { let menuItem = new PopupMenu.PopupMenuItem(