macOS notification state as a native node addon

Usage no npm install needed!

<script type="module">
  import macosNotificationState from '';



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)

// This will print a string indiciating the current state, being one of the following:
// If "do not disturb" is enabled, it takes precedence.

// This will print a string indiciating the current session state, being one of the following:

Not working?

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.