@@ -3,6 +3,10 @@ const fs = require('fs')
3
3
const { nativeTheme, systemPreferences, Menu, Tray, ipcMain, app, screen, globalShortcut, powerMonitor } = require ( 'electron' )
4
4
const Utils = require ( "./Utils" )
5
5
6
+ // Expose GC
7
+ app . commandLine . appendSwitch ( 'js-flags' , '--expose_gc --max-old-space-size=128' )
8
+ require ( "v8" ) . setFlagsFromString ( '--expose_gc' ) ; global . gc = require ( "vm" ) . runInNewContext ( 'gc' ) ;
9
+
6
10
// Handle multiple instances before continuing
7
11
const singleInstanceLock = app . requestSingleInstanceLock ( )
8
12
if ( ! singleInstanceLock ) {
@@ -1475,7 +1479,8 @@ function createPanel(toggleOnLoad = false) {
1475
1479
backgroundThrottling : false ,
1476
1480
spellcheck : false ,
1477
1481
enableWebSQL : false ,
1478
- v8CacheOptions : "none"
1482
+ v8CacheOptions : "none" ,
1483
+ additionalArguments : "--expose_gc"
1479
1484
}
1480
1485
} ) ;
1481
1486
@@ -1504,6 +1509,7 @@ function createPanel(toggleOnLoad = false) {
1504
1509
sendToAllWindows ( "panelBlur" )
1505
1510
showPanel ( false )
1506
1511
}
1512
+ global . gc ( )
1507
1513
} )
1508
1514
1509
1515
mainWindow . on ( 'move' , ( e ) => {
@@ -1874,10 +1880,11 @@ function createTray() {
1874
1880
tray . on ( 'mouse-move' , async ( ) => {
1875
1881
const now = Date . now ( )
1876
1882
if ( lastMouseMove + 500 > now ) return false ;
1883
+ lastMouseMove = now
1877
1884
bounds = tray . getBounds ( )
1878
1885
bounds = screen . dipToScreenRect ( null , bounds )
1879
1886
tryEagerUpdate ( )
1880
- lastMouseMove = now
1887
+ sendToAllWindows ( 'panel-unsleep' )
1881
1888
} )
1882
1889
1883
1890
nativeTheme . on ( 'updated' , async ( ) => {
0 commit comments