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 5959 "i" : " 0.3.6" ,
6060 "jsonwebtoken" : " 8.5.1" ,
6161 "lodash" : " ^4.17.4" ,
62+ "macos-notification-state" : " git://github.com/nbashkankov/macos-notification-state.git#c7959ecf657020a70b2720d1051fc5a3e4ecb118" ,
6263 "macos-version" : " 5.2.0" ,
6364 "marked" : " 0.6.1" ,
6465 "mdi" : " ^1.9.33" ,
Original file line number Diff line number Diff line change 11import { ipcMain } from 'electron' ;
2- import { execSync } from 'child_process' ;
32import { isMac } from '../../environment' ;
43
54const debug = require ( 'debug' ) ( 'Franz:ipcApi:dnd' ) ;
@@ -13,8 +12,12 @@ export default async () => {
1312 }
1413
1514 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' ;
1821
1922 debug ( 'Fetching DND state, set to' , isDND ) ;
2023 return isDND ;
You can’t perform that action at this time.
0 commit comments