Skip to content

Commit 06cb935

Browse files
authored
stop listening to power events on linux (#25972)
1 parent a154ede commit 06cb935

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

shared/desktop/app/node2.desktop.tsx

+19-15
Original file line numberDiff line numberDiff line change
@@ -367,21 +367,25 @@ const plumbEvents = () => {
367367
Electron.nativeTheme.on('updated', () => {
368368
mainWindowDispatch(ConfigGen.createSetSystemDarkMode({dark: Electron.nativeTheme.shouldUseDarkColors}))
369369
})
370-
Electron.powerMonitor.on('suspend', () => {
371-
mainWindowDispatch(ConfigGen.createPowerMonitorEvent({event: 'suspend'}))
372-
})
373-
Electron.powerMonitor.on('resume', () => {
374-
mainWindowDispatch(ConfigGen.createPowerMonitorEvent({event: 'resume'}))
375-
})
376-
Electron.powerMonitor.on('shutdown', () => {
377-
mainWindowDispatch(ConfigGen.createPowerMonitorEvent({event: 'shutdown'}))
378-
})
379-
Electron.powerMonitor.on('lock-screen', () => {
380-
mainWindowDispatch(ConfigGen.createPowerMonitorEvent({event: 'lock-screen'}))
381-
})
382-
Electron.powerMonitor.on('unlock-screen', () => {
383-
mainWindowDispatch(ConfigGen.createPowerMonitorEvent({event: 'unlock-screen'}))
384-
})
370+
371+
// this crashes on newer electron, unclear why
372+
if (!isLinux) {
373+
Electron.powerMonitor.on('suspend', () => {
374+
mainWindowDispatch(ConfigGen.createPowerMonitorEvent({event: 'suspend'}))
375+
})
376+
Electron.powerMonitor.on('resume', () => {
377+
mainWindowDispatch(ConfigGen.createPowerMonitorEvent({event: 'resume'}))
378+
})
379+
Electron.powerMonitor.on('shutdown', () => {
380+
mainWindowDispatch(ConfigGen.createPowerMonitorEvent({event: 'shutdown'}))
381+
})
382+
Electron.powerMonitor.on('lock-screen', () => {
383+
mainWindowDispatch(ConfigGen.createPowerMonitorEvent({event: 'lock-screen'}))
384+
})
385+
Electron.powerMonitor.on('unlock-screen', () => {
386+
mainWindowDispatch(ConfigGen.createPowerMonitorEvent({event: 'unlock-screen'}))
387+
})
388+
}
385389

386390
Electron.ipcMain.handle('KBdispatchAction', (_: any, action: any) => {
387391
mainWindow?.webContents.send('KBdispatchAction', action)

0 commit comments

Comments
 (0)