Skip to content

Instantly share code, notes, and snippets.

@gaqzi
Created April 15, 2024 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaqzi/f299047706c10b2616ba15c94cabf1fe to your computer and use it in GitHub Desktop.
Save gaqzi/f299047706c10b2616ba15c94cabf1fe to your computer and use it in GitHub Desktop.
Mute/unmute the current system microphone using AppleScript

To use this in Alfred create a new workflow and then create a new action Run Script and specify osascript (Javascript) and paste in the below script.

See global-microphone-muteunmute-shortcuts for more context.

set inputVolume to input volume of (get volume settings)
set whatHappened to ""
set originalInputVolume to inputVolume
if inputVolume <= 25 then
set inputVolume to 100
set whatHappened to "❇️"
else
set inputVolume to 0
set whatHappened to "❌"
end if
set volume input volume inputVolume
return whatHappened & " (was " & originalInputVolume & "%)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment