Last active
September 29, 2019 15:53
-
-
Save d-srd/e0656e9a8549c25cad54c2d1e21bbbd6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum DarkMode { | |
static var isEnabled: Bool { | |
let script = """ | |
tell application "System Events" | |
tell appearance preferences | |
get properties | |
return dark mode | |
end tell | |
end tell | |
""" | |
var error: NSDictionary? | |
return NSAppleScript(source: script)!.executeAndReturnError(&error).booleanValue | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment