Skip to content

Commit

Permalink
Add README
Browse files Browse the repository at this point in the history
  • Loading branch information
CominAtYou committed Aug 26, 2024
1 parent 8d73f7e commit 5b13cd5
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# AirMute
Mute your mic in Discord on Mac with your AirPods.

## What exactly is this?
As of writing, Discord doesn't support muting the microphone using your AirPods on macOS. This app aims to allow you to do so by registering for mute/unmute notifications from your AirPods, and then instructing Discord to mute or unmute your mic over RPC. Muting or unmuting your mic in Discord will also notify the AirPods that they have been unmuted or muted.

Here's a video of it in action:

https://gist.github.com/user-attachments/assets/f0c74cca-f60f-4415-9f00-cb6a0c2397ab

## Features
- Mute your Discord mic with your AirPods!
- A simple, clean, and minimal UI that stays out of your way whilst also providing helpful information on the status of the app.

## Requirements
- A Mac (Intel or Apple Silicon) with macOS 14.0 or higher.
- A pair of AirPods Pro.
- Have the Discord app installed on your Mac. This app doesn't work with the browser version of Discord.

## Setup
1. First, download the disk image of the latest version of the app from the [releases](https://github.com/CominAtYou/AirMute/releases/latest) page.
2. Open the disk image and drag the app to your Applications folder.
3. Next, head to the [Discord Developer Portal](https://discord.com/developers) and create a new application.
4. Click OAuth2 in the sidebar. Copy your client ID and client secret.
5. Add a redirect URI to `http://localhost`.
6. Launch the app, and click its menu bar icon (it looks like a person with waves) and select "Settings".
7. Paste your client ID and secret into this window. Then, close the window.
8. Quit the app by clicking its menu bar icon and selecting "Quit".
9. Open Discord if it isn't already open.
10. Open the app again.
11. If everything worked correctly, clicking the menu bar icon again should yield a line that says `Inactive - Not in Voice` or `Active - In Voice`.

## How does this work?
The Discord allows any application to interface and issue commands to it (with your approval, of course) over RPC. One of the things that RPC allows for is controlling whether or not your mic is muted or not, meaning that the app is able to instruct Discord to toggle the microphone whenever the AirPods are clicked.

### A more technical explanation, please?
Basically:
- [`AVAudioApplication.setInputMuteStateChangeHandler(_:)`](https://developer.apple.com/documentation/avfaudio/avaudioapplication/4191602-setinputmutestatechangehandler) lets you register a callback for when the AirPods have been clicked to mute.
- Discord exposes a Unix socket in /var/tmp that allows for external processes to control and recieve information about some aspects of the client over [RPC](https://discord.com/developers/docs/topics/rpc).
- Using these two, it's possible to get notifications for when the AirPods are muted, as well as when the mic has been muted within the Discord client itself, and dispatch the information to both the AirPods or Discord to keep things in sync.

## Questions? Answers!
### How do I see the current status of the app?
Clicking the app's menu bar icon will yield a menu that'll tell you if the app is active or not (the app is only active when you're in voice), and will also let you know why the app is inactive, or of any errors that might have occured.

### What does "Click stem to undeafen" in the app's settings do?
Enabling this setting will let you undeafen yourself by clicking the stem on your AirPods whilst deafened. Turning it off will prevent you from being undeafened when clicking the stem, but it won't unmute you either.

## Something not working?
### Check the status menu first!
Click the app's menu bar icon to see if any erorrs are being reported. That should give you a pointer as to what might be wrong.
### Maybe there's an update!
Check the [releases](https://github.com/CominAtYou/AirMute/releases/latest) for a newer version of the app. It might have fixed the issue you're experiencing.
### No luck?
Open an issue, and let me know what's up. I'll take a look and do my best to track down what might be going awry.

0 comments on commit 5b13cd5

Please sign in to comment.