Created
April 13, 2023 19:04
-
-
Save Ptujec/d135acdc88f0e69613d2aad5fd9b056c to your computer and use it in GitHub Desktop.
Quick Applescript that toggles dark mode for a selected app in LaunchBar
This file contains 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
on open (_file) | |
try | |
set bID to bundle identifier of (info for (_file)) | |
set currentState to do shell script "defaults read " & bID & " NSRequiresAquaSystemAppearance" | |
if currentState is "1" then | |
do shell script "defaults write " & bID & " NSRequiresAquaSystemAppearance -bool no" | |
else | |
do shell script "defaults write " & bID & " NSRequiresAquaSystemAppearance -bool yes" | |
end if | |
tell application id (bID as text) | |
if it is running then | |
quit | |
delay 0.5 | |
launch | |
end if | |
activate | |
end tell | |
on error e | |
tell me to activate | |
display dialog e | |
end try | |
end open |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment