From 16e65d39be7c1c1c4e7963a3a5f34c8c02ddfd28 Mon Sep 17 00:00:00 2001 From: fullex <106392080+0xfullex@users.noreply.github.com> Date: Sun, 13 Jul 2025 00:30:01 +0800 Subject: [PATCH] fix: [Linux] support Linux Wayland global shortcuts (#8080) feat: support Linux Wayland global shortcuts --- src/main/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/index.ts b/src/main/index.ts index e022bb71a8..97bd10bcf7 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -11,7 +11,7 @@ import { app } from 'electron' import installExtension, { REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } from 'electron-devtools-installer' import Logger from 'electron-log' -import { isDev, isWin } from './constant' +import { isDev, isWin, isLinux } from './constant' import { registerIpc } from './ipc' import { configManager } from './services/ConfigManager' import mcpService from './services/MCPService' @@ -46,6 +46,14 @@ if (isWin) { app.commandLine.appendSwitch('wm-window-animations-disabled') } +/** + * Enable GlobalShortcutsPortal for Linux Wayland Protocol + * see: https://www.electronjs.org/docs/latest/api/global-shortcut + */ +if (isLinux && process.env.XDG_SESSION_TYPE === 'wayland') { + app.commandLine.appendSwitch('enable-features', 'GlobalShortcutsPortal') +} + // Enable features for unresponsive renderer js call stacks app.commandLine.appendSwitch('enable-features', 'DocumentPolicyIncludeJSCallStacksInCrashReports') app.on('web-contents-created', (_, webContents) => {