File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ const Noti = {
20
20
} ) )
21
21
}
22
22
}
23
+ let isNoti = ! appStore . get ( 'closeNotification' ) && platform . isMacOS
24
+ platform . isMacOS && appStore . onDidChange ( 'closeNotification' , ( v ) => { isNoti = ! v } )
23
25
24
26
let scrcpyPath = 'scrcpy'
25
27
// @ts -ignore - .
@@ -44,7 +46,7 @@ const Scrcpy = {
44
46
this . scrcpy . stderr ! . on ( 'data' , ( errorOutput ) => {
45
47
console . error ( `标准错误: ${ errorOutput . toString ( ) } ` )
46
48
ipcMain . emit ( 'scrcpyMessage' , { type : 'stderr' , data : errorOutput . toString ( ) } )
47
- new Notification ( {
49
+ isNoti && new Notification ( {
48
50
title : 'Scrcpy 错误提示' ,
49
51
body : errorOutput . toString ( ) ,
50
52
silent : true
@@ -55,14 +57,14 @@ const Scrcpy = {
55
57
console . log ( `子进程退出码: ${ code } ` )
56
58
this . close ( )
57
59
ipcMain . emit ( 'scrcpyMessage' , { type : 'close' , data : 'scrcpy 已关闭' } )
58
- Noti . close . show ( )
60
+ isNoti && Noti . close . show ( )
59
61
} )
60
62
61
63
this . scrcpy . on ( 'error' , ( err ) => {
62
64
console . error ( `子进程启动失败: ${ err } ` )
63
65
this . close ( )
64
66
ipcMain . emit ( 'scrcpyMessage' , { type : 'error' , data : 'scrcpy 启动失败' } )
65
- Noti . error . show ( )
67
+ isNoti && Noti . error . show ( )
66
68
} )
67
69
} ,
68
70
stop ( ) {
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ export const appStore = new Store({
9
9
scrcpyOptions : [ ] as string [ ] ,
10
10
hideDock : false ,
11
11
hideWindow : false ,
12
+ closeNotification : false ,
12
13
isStartScrcpy : false
13
14
}
14
15
} )
Original file line number Diff line number Diff line change @@ -42,6 +42,16 @@ const trayTemplate: Parameters<typeof Menu.buildFromTemplate>[0] = [
42
42
appStore . set ( 'hideDock' , menuItem . checked )
43
43
menuItem . checked ? app . dock . hide ( ) : app . dock . show ( )
44
44
}
45
+ } , {
46
+ id : 'closeNotification' ,
47
+ label : 'Close Notification' ,
48
+ type : 'checkbox' ,
49
+ get checked ( ) {
50
+ return appStore . get ( 'closeNotification' )
51
+ } ,
52
+ click : ( menuItem ) => {
53
+ appStore . set ( 'closeNotification' , menuItem . checked )
54
+ }
45
55
} ] as Parameters < typeof Menu . buildFromTemplate > [ 0 ]
46
56
: [ ] as any ) ,
47
57
{
You can’t perform that action at this time.
0 commit comments