File tree Expand file tree Collapse file tree 4 files changed +10
-23
lines changed
Expand file tree Collapse file tree 4 files changed +10
-23
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77## [ Unreleased]
88### Fixed
99- Linux DND detection
10+ - improve macOS DND detection
1011- debug info when from Windows Store
1112
1213## [ 1.17.1] - 2024-12-25
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class DndManager extends EventEmitter {
1515 this . windowsFocusAssist = require ( 'windows-focus-assist' )
1616 this . windowsQuietHours = require ( 'windows-quiet-hours' )
1717 } else if ( process . platform === 'darwin' ) {
18- this . macosNotificationState = require ( 'macos-notification-state ' )
18+ this . util = require ( 'node:util ' )
1919 } else if ( process . platform === 'linux' ) {
2020 this . bus = require ( 'dbus-final' ) . sessionBus ( )
2121 this . util = require ( 'node:util' )
@@ -124,7 +124,13 @@ class DndManager extends EventEmitter {
124124 const wqh = this . windowsQuietHours . getIsQuietHours ( )
125125 return wqh || ( wfa !== - 1 && wfa !== 0 )
126126 } else if ( process . platform === 'darwin' ) {
127- return this . macosNotificationState . getDoNotDisturb ( )
127+ try {
128+ const exec = this . util . promisify ( require ( 'node:child_process' ) . exec )
129+ const { stdout } = await exec ( 'defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes"' )
130+ if ( stdout . replace ( / [ ^ 0 - 9 a - z A - Z ] / g, '' ) === '1' ) {
131+ return true
132+ }
133+ } catch ( e ) { }
128134 } else if ( process . platform === 'linux' ) {
129135 return await this . _isDndEnabledLinux ( )
130136 }
Original file line number Diff line number Diff line change 7070 ],
7171 "extendInfo" : {
7272 "LSBackgroundOnly" : 1 ,
73- "LSUIElement" : 1 ,
74- "NSFocusStatusUsageDescription" : " Stretchly will respect Do Not Disturb mode"
73+ "LSUIElement" : 1
7574 }
7675 },
7776 "linux" : {
157156 "i18next" : " ^23.16.8" ,
158157 "i18next-fs-backend" : " ^2.6.0" ,
159158 "luxon" : " ^3.5.0" ,
160- "macos-notification-state" : " ^3.0.0" ,
161159 "meeussunmoon" : " ^3.0.3" ,
162160 "ps-list" : " 7.2" ,
163161 "rtl-detect" : " ^1.1.2" ,
You can’t perform that action at this time.
0 commit comments