Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CrushedPixel/66a9c1ac7ca38887070f987e818fe412 to your computer and use it in GitHub Desktop.
Save CrushedPixel/66a9c1ac7ca38887070f987e818fe412 to your computer and use it in GitHub Desktop.
AppleScript code to set the theme of a JetBrains IDE, in my case CLion. I use this with an Automator Action to change to Dark/Light Mode in macOS Mojave and change the CLion theme at the same time. The code in action: https://streamable.com/0wrvn
on run {input, parameters}
tell application "System Events" to set frontmost of process "CLion" to true
tell application "System Events"
tell process "CLion"
-- close the preferences window if it's open
key code 53 -- esc
delay 0.5
-- open the preferences window
keystroke "," using {command down}
delay 0.5
-- search for "theme"
keystroke "theme"
delay 2.0
-- select the first entry of the search results using the up key,
-- and then using the down key to navigate to the "Appearance" entry
repeat 2 times -- the search results only have 3 entries
key code 126 -- up
delay 0.5
end repeat
key code 125 -- down
delay 0.5
-- press enter to select the Themes dropdown
key code 36 -- enter
delay 0.5
-- press space to open the dropdown
key code 49 -- space
delay 0.5
-- press up to select the "Light" theme (use down/125 to select "Darcula")
key code 126 -- up
delay 0.5
-- press enter to close the dropdown
key code 36 -- enter
delay 0.5
-- press enter to apply the new settings
key code 36 -- enter
end tell
end tell
return input
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment