Skip to content

Instantly share code, notes, and snippets.

@drewkerr
drewkerr / get-focus-mode.js
Last active April 18, 2024 14:02
Read the current Focus mode on macOS Monterey (12.0+) using JavaScript for Automation (JXA)
const app = Application.currentApplication()
app.includeStandardAdditions = true
function getJSON(path) {
const fullPath = path.replace(/^~/, app.pathTo('home folder'))
const contents = app.read(fullPath)
return JSON.parse(contents)
}
function run() {