File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ let isRecording = false;
143143
144144// Hybrid PTT State
145145let pressedKeys = new Set ( ) ;
146+ let isExplicitQuit = false ;
146147let recordingStartTime = 0 ;
147148let isLatched = false ; // true if "Tapped" (latched on), false if "Holding"
148149let isPaused = false ; // To pause listener (e.g. when recording hotkey in UI)
@@ -292,8 +293,11 @@ function buildTrayMenu() {
292293 { type : "separator" } ,
293294 {
294295 label : "Sair" ,
295- accelerator : "CmdOrCtrl+Q" ,
296- click : ( ) => app . quit ( ) ,
296+ // accelerator: "CmdOrCtrl+Q", // Disabled to prevent global shortcut from triggering quit directly
297+ click : ( ) => {
298+ isExplicitQuit = true ;
299+ app . quit ( ) ;
300+ } ,
297301 } ,
298302 ] ) ;
299303}
@@ -1167,8 +1171,13 @@ app.on("window-all-closed", () => {
11671171 // Don't quit on window close, keep running in tray
11681172} ) ;
11691173
1170- app . on ( "before-quit" , ( ) => {
1171- app . isQuitting = true ;
1174+ app . on ( "before-quit" , ( e ) => {
1175+ if ( isExplicitQuit ) {
1176+ app . isQuitting = true ;
1177+ } else {
1178+ e . preventDefault ( ) ;
1179+ mainWindow ?. hide ( ) ;
1180+ }
11721181} ) ;
11731182
11741183app . on ( "will-quit" , ( ) => {
You can’t perform that action at this time.
0 commit comments