diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index 042bd14dbe..650c3c8f84 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -2606,6 +2606,14 @@ Zotero.Utilities.Internal.activate = new function () { } return function (win) { + let isWayland = true; + if (Zotero.isLinux) { + try { + let sessionType = Services.env.get('XDG_SESSION_TYPE'); + isWayland = sessionType === 'wayland'; + } + catch (e) {} + } if (Zotero.isMac) { if (win) { Components.utils.import("resource://gre/modules/ctypes.jsm"); @@ -2655,7 +2663,7 @@ Zotero.Utilities.Internal.activate = new function () { Zotero.Utilities.Internal.executeAppleScript(script); } } - else if (Zotero.isLinux && win) { + else if (Zotero.isLinux && !isWayland && win) { Components.utils.import("resource://gre/modules/ctypes.jsm"); if (_x11 === false) return; @@ -2867,7 +2875,7 @@ Zotero.Utilities.Internal.activate = new function () { }, 50); }, false); } - else if (Zotero.isWin && win) { + else if ((Zotero.isWin || Zotero.isLinux) && win) { // Try to focus the window. This is necessary as focusing a node inside // of the window may not necessarily activate the window. win.focus();