File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 59
59
"i" : " 0.3.6" ,
60
60
"jsonwebtoken" : " 8.5.1" ,
61
61
"lodash" : " ^4.17.4" ,
62
+ "macos-notification-state" : " git://github.com/nbashkankov/macos-notification-state.git#c7959ecf657020a70b2720d1051fc5a3e4ecb118" ,
62
63
"macos-version" : " 5.2.0" ,
63
64
"marked" : " 0.6.1" ,
64
65
"mdi" : " ^1.9.33" ,
Original file line number Diff line number Diff line change 1
1
import { ipcMain } from 'electron' ;
2
- import { execSync } from 'child_process' ;
3
2
import { isMac } from '../../environment' ;
4
3
5
4
const debug = require ( 'debug' ) ( 'Franz:ipcApi:dnd' ) ;
@@ -13,8 +12,12 @@ export default async () => {
13
12
}
14
13
15
14
try {
16
- const dndQueryResponse = execSync ( 'defaults read com.apple.controlcenter "NSStatusItem Visible DoNotDisturb"' ) ;
17
- const isDND = Buffer . from ( dndQueryResponse ) . toString ( ) . trim ( ) === '1' ;
15
+ // eslint-disable-next-line global-require
16
+ const { getNotificationState } = require ( 'macos-notification-state' ) ;
17
+
18
+ const state = getNotificationState ( ) ;
19
+
20
+ const isDND = state === 'DO_NOT_DISTURB' ;
18
21
19
22
debug ( 'Fetching DND state, set to' , isDND ) ;
20
23
return isDND ;
You can’t perform that action at this time.
0 commit comments