Skip to content

Enhancement: Add a three-state per-app volume lock (free, session, persistent) - #130

Merged
G-Stas merged 8 commits into
G-Stas:mainfrom
ElektroStudios:feature/app-volume-lock
Nov 3, 2026
Merged

G-Stas merged 8 commits into
G-Stas:mainfrom
ElektroStudios:feature/app-volume-lock

Conversation

@ElektroStudios

Copy link
Copy Markdown
Contributor

Closes #47. Partially addresses #69.

What

Each app in the mixer now has a lock button with three states:

  1. Free: nothing changes.
  2. Locked for this session: the app keeps its volume until it exits or Volumey closes. Nothing is saved.
  3. Persistent: the lock is saved in settings.json and applied again each time the app starts, also after a reboot.

While locked:

  • The slider is disabled and the button shows the state.
  • Changes made by the app itself, by a game at any time (even after several seconds), or by the Windows volume mixer are reverted.
  • Hotkeys, app volume sync and the volume limit cannot change it either.

When Volumey closes, locked apps get back the volume they had before being locked, so nothing stays muted or stuck once Volumey is not running. Persistent locks are kept and applied at the next start.

This solves #47 (apps such as Alexa starting at 100% after a reboot).

It can also be used as a blacklist-like workaround for #69: apps that always start at 100% (e.g. the WhatsApp desktop app) can be locked persistently at 0%, muted or 10%. It is not a full whitelist/blacklist for the "Limit the launched app volume if it is 100%" option.

How

  • AudioProcessModel: lock state (LockMode), a guard in the Volume setter and a handler on every session's VolumeChanged that puts the locked volume back. New sessions of a locked app get the volume too.
  • Event driven, no polling. The correction runs on the thread pool and is coalesced, because the audio API must not be called from inside a session notification callback.
  • AppVolumeLockViewModel (new feature): handles the button, locks the app on all devices, saves General.LockedAppVolumes and applies the saved entries to apps that are running or start later. Closing Volumey releases the locks through it.
  • SessionsListView.xaml: lock button (icon and tooltip per state) and slider disabled while locked.
  • New strings in all languages.
  • Tests: model, view model, exit and settings round trip.

Notes

  • The lock applies to the app's Windows session volume, the one Volumey controls. A player with its own internal volume slider can still be turned down from inside the player.
  • Apps are identified by AudioProcessModel.Name (the executable description), the same mechanism the per-app hotkeys use. Two different apps with the same description would share a lock. If that turns out to be a problem, more fields (e.g. CompanyName, ProductName) could be considered.

Testing

Tested only on Windows 10.

134124124 000

Let me know if anything needs changes, and feel free to change anything on top of my branch.

Add a lock button to every app row of the mixer. It goes through
three states: free, locked until the app exits, and locked also when
the app starts again.

While locked, the app's slider is disabled and any change to its
volume is reverted: the app itself, a game at any time, the Windows
mixer, hotkeys, app volume sync and the volume limit.

The enforcement is event driven (session volume notifications, no
polling) and the audio API is never called from inside a
notification callback. Persistent locks are saved in settings.json
(General.LockedAppVolumes) and applied each time the app starts, on
any device. Apps are matched by AudioProcessModel.Name, like the
per-app hotkeys. When Volumey closes, locked apps get back the volume
they had before being locked.
@G-Stas

G-Stas commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

I will redesign this to something like on the mockup, but the feature itself is nice
image

…l rebuilds

The lock mode is set on the app's models instead of cycling a button.
An app locked until it closes is kept by its name and processes, so a
model made again (format change, device re-enabled, a move) or on
another device is locked too; a restarted app is free.
The lock button on each row is replaced by a three-part bar (Off,
Until closed, Always) under the device box of the opened app, so every
app but the System Sounds opens. A locked app's row shows a pill with
the mode's icon and word, and its slider and number are greyed. Badges
that don't fit next to the name move to a line of their own under it.
Until closed holds the volume, shows a pill and greys the slider; a
restarted app is free; Always is saved and locks the app each time it
starts; app hotkeys don't change a locked app; a locked app stays locked
after a move to another device; the System Sounds have no lock.
The row is named in the Windows display language, which the app saves
in General.SystemSoundsName.
Until-closed locks end once none of their processes runs, so a reused
process ID doesn't bring one back. A cut-off name or device badge shows
its full text in a tooltip. The lock mode's word comes from one
converter (keys LockMode_*), the process IDs from AudioProcessModel,
NameLinePanel's spacing is constant, and the UI tests share their row
and drop-down helpers; TestAudioApp.Start takes a StartVolume.
Every session of a locked app is held and a new one starts at the locked
volume; Always holds the app again after Volumey restarts; Until closed
ends with a restart.
…e on exit

AppVolumeLock holds one app's lock (mode, held volume and the volume it gets
back on exit as one VolumeLock record) and keeps its sessions at the volume;
AudioProcessModel only owns it. The mixer binds Lock.Mode and Lock.IsOn.

The view model keeps every held app with its lock, so a model made again
(format change, a move, another device) and a mode change keep the volume
from before the lock instead of the held one. A held app's processes are
checked with its executable's path, so a reused process ID doesn't keep a
lock alive.

The modes are named like the lock bar (Off, UntilClosed, Always), and the
lock mode name binding is shared by the label and the item names.
@G-Stas
G-Stas merged commit 41d40f0 into G-Stas:main Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Save settings across reboots

2 participants