sindresorhus / Do Not Disturb
Licence: mit
Control the macOS `Do Not Disturb` feature
Stars: ✭ 155
Programming Languages
swift
15916 projects
Labels
Projects that are alternatives of or similar to Do Not Disturb
Alfred Vscode
Alfred 3 workflow that allows you to browse and open Visual Studio Code projects or simply open specified folders/files
Stars: ✭ 141 (-9.03%)
Mutual labels: npm-package
Kafkajs
A modern Apache Kafka client for node.js
Stars: ✭ 2,315 (+1393.55%)
Mutual labels: npm-package
Handlebars Webpack Plugin
Renders your html-template at build time
Stars: ✭ 135 (-12.9%)
Mutual labels: npm-package
Transliterate
Convert Unicode characters to Latin characters using transliteration
Stars: ✭ 152 (-1.94%)
Mutual labels: npm-package
To Milliseconds
Convert an object of time properties to milliseconds: `{seconds: 2}` → `2000`
Stars: ✭ 136 (-12.26%)
Mutual labels: npm-package
Create React Component Folder
Creates react component folder structure
Stars: ✭ 139 (-10.32%)
Mutual labels: npm-package
React Bnb Gallery
Simple react-based photo gallery inspired by Airbnb image gallery.
Stars: ✭ 145 (-6.45%)
Mutual labels: npm-package
Ag Psd
Javascript library for reading and writing PSD files
Stars: ✭ 135 (-12.9%)
Mutual labels: npm-package
Ohshitgit
⁉️Oh shit! A cli tool to help you unfuck your git mistakes
Stars: ✭ 135 (-12.9%)
Mutual labels: npm-package
Csv Writer
Convert objects/arrays into a CSV string or write them into a CSV file
Stars: ✭ 140 (-9.68%)
Mutual labels: npm-package
Gloria
Gloria is a static website generator, based on NodeJS.
Stars: ✭ 153 (-1.29%)
Mutual labels: npm-package
Inspirational Quotes
💡 A simple NPM Package which returns random Inspirational Quotes. Get your daily quote and stay motivated! ✌️ 🌸
Stars: ✭ 150 (-3.23%)
Mutual labels: npm-package
Aws Lambda Libreoffice
85 MB LibreOffice to fit inside AWS Lambda compressed with Brotli
Stars: ✭ 145 (-6.45%)
Mutual labels: npm-package
do-not-disturb
Control the macOS
Do Not Disturb
feature
Note that this package does not work inside a sandboxed app.
Install
$ npm install @sindresorhus/do-not-disturb
Usage
import doNotDisturb from '@sindresorhus/do-not-disturb';
await doNotDisturb.enable();
API
doNotDisturb
All the methods return a Promise
. You only really need to await
them if you use multiple methods at once.
.enable(): Promise<void>
.disable(): Promise<void>
.toggle(force?): Promise<void>
force
Type: boolean
Force it to be enabled/disabled.
.isEnabled(): Promise<boolean>
.on('change', listener, options): EventEmitter
Attach an event listener that gets called when the "Do Not Disturb" state changes.
options
Type: object
pollInterval
Type: number
Default: 3000
Interval in milliseconds at which the polling for the change
event is made.
.off('change', listener): EventEmitter
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);
Related
- 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…
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].