
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
macos-notification-state
Advanced tools
Do you want to check if you should display a notification to your user on macOS? This native module checks if the user is active, if the screen is locked, or if "do not disturb" is enabled.
npm install macos-notification-state
const { getNotificationState, getSessionState, getDoNotDisturb } = require('macos-notification-state`)
// This will brint a boolean (true if enabled, false if not)
console.log(getDoNotDisturb())
// This will print a string indiciating the current state, being one of the following:
// 'SESSION_SCREEN_IS_LOCKED'
// 'SESSION_ON_CONSOLE_KEY'
// 'DO_NOT_DISTURB'
// 'UNKNOWN'
// 'UNKNOWN_ERROR'
//
// If "do not disturb" is enabled, it takes precedence.
console.log(getNotificationState())
// This will print a string indiciating the current session state, being one of the following:
// 'SESSION_SCREEN_IS_LOCKED'
// 'SESSION_ON_CONSOLE_KEY'
// 'UNKNOWN'
console.log(getSessionState())
This package needs to be compiled with at least the macOS 11.0 SDK. If not, the internal operating system info will always return 10.16, rendering the package unusable.
To see the current version, run xcrun --show-sdk-version
.
MIT, please see LICENSE for details. Copyright (c) 2019 Felix Rieseberg.
FAQs
macOS notification state as a native node addon
The npm package macos-notification-state receives a total of 547 weekly downloads. As such, macos-notification-state popularity was classified as not popular.
We found that macos-notification-state demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.