@@ -9,7 +9,7 @@ import { Format, LogLevel, setGlobalFormat, setGlobalLogLevel, useLogg } from '@
99import { createLoggLogger , injecta } from '@proj-airi/injecta'
1010import { app , Menu , nativeImage , Tray } from 'electron'
1111import { noop , once } from 'es-toolkit'
12- import { isMacOS } from 'std-env'
12+ import { isLinux , isMacOS } from 'std-env'
1313
1414import icon from '../../resources/icon.png?asset'
1515import macOSTrayIcon from '../../resources/tray-icon-macos.png?asset'
@@ -29,6 +29,20 @@ setupDebugger()
2929
3030const log = useLogg ( 'main' ) . useGlobalConfig ( )
3131
32+ // Thanks to [@blurymind ](https://github.com/blurymind),
33+ //
34+ // When running Electron on Linux, navigator.gpu.requestAdapter() fails.
35+ // In order to enable WebGPU and process the shaders fast enough, we need the following
36+ // command line switches to be set.
37+ //
38+ // https://github.com/electron/electron/issues/41763#issuecomment-2051725363
39+ // https://github.com/electron/electron/issues/41763#issuecomment-3143338995
40+ if ( isLinux ) {
41+ app . commandLine . appendSwitch ( 'enable-features' , 'SharedArrayBuffer' )
42+ app . commandLine . appendSwitch ( 'enable-unsafe-webgpu' )
43+ app . commandLine . appendSwitch ( 'enable-features' , 'Vulkan' )
44+ }
45+
3246app . dock ?. setIcon ( icon )
3347electronApp . setAppUserModelId ( 'ai.moeru.airi' )
3448
0 commit comments