Control the macOS
Do Not Disturb
feature
Note that this package does not work inside a sandboxed app.
$ npm install @sindresorhus/do-not-disturb
import doNotDisturb from '@sindresorhus/do-not-disturb';
await doNotDisturb.enable();
All the methods return a Promise
. You only really need to await
them if you use multiple methods at once.
Type: boolean
Force it to be enabled/disabled.
Attach an event listener that gets called when the "Do Not Disturb" state changes.
Type: object
Type: number
Default: 3000
Interval in milliseconds at which the polling for the change
event is made.
Remove an event listener that was attached previously.
import doNotDisturb from '@sindresorhus/do-not-disturb';
const listener = status => {
console.log(`Do Not Disturb status: ${status}`);
}
doNotDisturb.on('change', listener, {pollInterval: 100});
// …
doNotDisturb.off('change', listener);
- do-not-disturb-cli - CLI for this module
- dark-mode - Control the macOS dark mode
- macos-wallpaper - Manage the desktop wallpaper
- file-icon - Get the icon of a file or app as a PNG image
- app-path - Get the path to an app
- More…