Skip to content

Enhancement: Configurable middle-click actions for the tray icon - #124

Merged
G-Stas merged 11 commits into
G-Stas:mainfrom
ElektroStudios:feature/tray-middle-click-action_0
Oct 31, 2026
Merged

G-Stas merged 11 commits into
G-Stas:mainfrom
ElektroStudios:feature/tray-middle-click-action_0

Conversation

@ElektroStudios

@ElektroStudios ElektroStudios commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

This PR introduces a small quality-of-life feature: the ability to customize what happens when middle-clicking the Volumey tray icon.

By default, it does nothing (preserving current behavior), but users can now configure it in the General settings page to either:

  • Toggle mute for the current default output device.
  • Switch device, automatically cycling to the next available output device.

Here is how the new option looks in the settings:

Tray Middle Click Option

Technical details:

  • Leveraged the existing TrayMiddleMouseDown native event from H.NotifyIcon.
  • Added the TrayMiddleClickAction enum to the settings architecture, wired to the UI via a new converter (TrayMiddleClickActionConverter) for full localization support (translations included for all languages).
  • The device switching logic simply cycles through the ActiveDevices list and skips execution safely if 1 or 0 devices are available.
  • OSD integration behaves exactly like the mouse wheel: it displays the mute status or the new default device automatically using the existing NotificationService logic without needing new UI hooks.
  • Added unit tests to DeviceProviderViewModelTests covering the device cycling and edge cases.

Let me know if anything needs adjustment! Or feel free to change anything on top of my branch.

ElektroStudios and others added 11 commits October 30, 2026 16:45
Introduces a new setting to customize the middle-click behavior on the tray icon. Users can choose to do nothing (default), toggle mute on the default device, or cycle through available output devices. Includes UI integration in the General settings page and unit tests for the device cycling logic.
Two quick middle clicks both switched to the same device: DefaultDevice only
changes once Windows reports the switch. The dead null check on ActiveDevices
and the index loop are gone.
MasterSessionModel.ToggleMute is used by the mute hotkey and the middle click;
the wheel and the middle click pick their device and show the OSD through
TrayTargetMaster and NotifyIfHidden.
EnumNameConverter takes the resource key prefix as its parameter and replaces
ThemeNameConverter and TrayMiddleClickActionConverter.
The General page names the actions in the UI language, the choice survives a
restart, and a middle click on the tray icon mutes and unmutes the default
device (OSD only when on and the mixer is closed; Do nothing changes nothing).
Conflicts: the resx files (main's mixer routing strings and the middle-click
strings both added at the end: kept both), the tray icon switch replaced by
TrayIconKind on main (the middle-click action sits next to it), and main's own
EnumNameConverter (main's comment kept).
@G-Stas

G-Stas commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Added some things before merging:

  • Quick middle clicks now actually cycle through the devices. Before, two quick clicks landed on the same one.
  • Mute and the tray wheel now share the same device/notice logic instead of copying it.
  • One converter instead of two.
  • The setting’s title wraps instead of getting cut off.
  • Some tests.

@G-Stas G-Stas added the enhancement New feature or request label Oct 31, 2026
@G-Stas
G-Stas merged commit 284b11a into G-Stas:main Oct 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants