Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Ptujec/d135acdc88f0e69613d2aad5fd9b056c to your computer and use it in GitHub Desktop.
Save Ptujec/d135acdc88f0e69613d2aad5fd9b056c to your computer and use it in GitHub Desktop.
Quick Applescript that toggles dark mode for a selected app in LaunchBar
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