| .gitignore | ||
| FyneApp.toml | ||
| go.mod | ||
| go.sum | ||
| Icon.png | ||
| LICENSE | ||
| main.go | ||
| README.md | ||
AudioLock
Note: Pre-release software. Breaking changes are expected while we harden the CoreAudio integration and APIs.
AudioLock is a tiny Windows tray app that keeps your default audio devices locked to what you choose. It periodically resets the system defaults so other apps can’t switch them behind your back, and it can also react immediately to device/default changes.
The app uses a native Windows CoreAudio module and a Fyne-based GUI. No external tools are required.
Features
- System tray app with no main window by default
- Enable/disable enforcement from the tray
- Settings window to configure:
- Default Playback device (select from currently active devices)
- Default Capture (microphone) device (select from currently active devices)
- Enforcement interval (seconds) and an on/off toggle for interval-based enforcement
- Start with Windows option
- React to device/default changes (event subscription)
- Enable/disable notifications
- “Force defaults now” action from the tray
- Single-instance: launching AudioLock again will exit immediately if an instance is already running
How it works
- CoreAudio is used directly to set and read default devices via the
coreaudiomodule. - All CoreAudio calls are marshaled onto a single dedicated COM thread owned by the module.
- On a timer (default every 10 seconds), if interval enforcement is enabled, the app ensures your chosen devices are set as the defaults.
- When device/default change events arrive via subscription, the app re-applies your defaults as needed.
- For each flow:
- Playback (Render): sets both Console and Communications roles to the selected device
- Capture (Microphone): sets both Console and Communications roles to the selected device
- Preferences are stored using Fyne’s app storage under the fixed app ID
com.callial.audiolock.
Requirements
- Windows (intended usage)
- Go 1.25+ (only for building from source)
Using AudioLock
- Start AudioLock. It sits in the system tray.
- From the tray menu:
- Enable enforcement: master on/off toggle
- Open settings: select Playback/Capture devices, adjust interval and options; then Save
- Force defaults now: immediately applies your defaults once
- Quit: exits the app
Notes:
- Closing the settings window just hides it; the app continues to run in the tray.
- Enabling “Start with Windows” adds an entry to your user Run key so AudioLock starts at login.
Build
Requires Go 1.25+ (module git.callial.com/Callial/AudioLock). The repo uses Fyne v2.
Basic build (Windows):
go build -o AudioLock.exe
You can run straight from go run as well:
go run .
Configuration storage
AudioLock uses Fyne’s preferences with the app ID com.callial.audiolock.
Preference keys (for reference):
playbackDeviceId: CoreAudio device ID for the default playback devicecaptureDeviceId: CoreAudio device ID for the default capture deviceintervalSeconds: timer period in seconds (defaults to 10)intervalEnabled: whether interval-based enforcement runs (defaults to true)enabled: master enforcement toggle (tray)startupWithWindows: requested startup state; actual registry value is kept in sync best-effortlistenDeviceChanges: whether reacting to device/default changes is enablednotificationsEnabled: whether notifications (e.g., missing device) are shown
Defaults:
- Interval: 10 seconds
- Interval enforcement: enabled
- Master enforcement: enabled on first run
Notes and limitations
- Devices must be active to appear in the selection lists. Selections persist even if currently unavailable; enforcement will warn and skip until the device returns.
- Enforcement sets both Console and Communications roles to the same device. Different-per-role defaults are not currently supported.
- The app is Windows-focused; other platforms are not supported.
Tray menu reference
- Enable enforcement
- Open settings
- Force defaults now
- Quit
Local development (workspace)
This repository is set up to use a Go workspace for local development alongside the coreaudio module.
- A
go.workfile can be used locally to link./coreaudiowithout editinggo.mod. - Do not commit
go.workorgo.work.sum(they should be in.gitignore). - Example workspace file:
go 1.25
use (
.
./coreaudio
)
License
MIT. See LICENSE.
Third‑party notice: Dependencies are licensed by their respective authors under their own licenses. See go.mod/go.sum and the upstream projects.