Skip to content

Instantly share code, notes, and snippets.

@wisq
Created November 16, 2022 22:04
Show Gist options
  • Save wisq/df0fac411e12d21667658aeb1829ec7f to your computer and use it in GitHub Desktop.
Save wisq/df0fac411e12d21667658aeb1829ec7f to your computer and use it in GitHub Desktop.
-- Record current app so we can switch back to it after.
tell application "System Events"
set frontmostApplicationName to name of 1st process whose frontmost is true
end tell
-- Switch to Discord and hit cmd-shift-M.
-- This is a built-in keybind and does not require any setup.
tell application "Discord" to activate
tell application "System Events"
keystroke "m" using {command down, shift down}
-- Give it some time to register.
delay 0.1
end tell
-- Return to the previous app.
tell application frontmostApplicationName
activate
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment