Repository navigation
Enhancement: Add tray icon option to use Windows' own volume icons - #129
Conversation
Add a "Windows volume icons" value to the tray icon setting. It shows the glyphs of Windows' own volume icon (read from SndVolSSO) in place of Volumey's, following the volume, mute and no-device states, so a customized set keeps showing in the tray. - TrayIconKind.SystemIcons, offered in the General page's tray icon box - SystemIconProvider reads the icons by resource ID from SystemResources\SndVolSSO.dll.mun, or System32\SndVolSSO.dll when there is no .mun file - IconType.Zero: Windows has its own glyph for a volume of zero; it is only used by this option - a glyph missing from the file falls back to Volumey's own - strings added to all language resources - tests for the glyph picking, the converter, the resource table, the settings and the real file
|
The icons are actually in the same place in Windows 11. How about we just replace old VolumeLevel mode with your new one? Don't see much point in the old one |
I'd keep both, since they give the user a choice of look:
Someone who likes Volumey's look keeps it, and someone who wants the tray to match Windows (or their patched icons) can pick that. Honestly, I believe it would be a mistake to remove/reduce the customization options available to the end user. That said, if you still prefer a single mode, I can replace VolumeLevel and keep Volumey's glyphs only as a fallback for when the system file can't be read for any reason. In that case, there is one thing to decide first: the system icons are read with ExtractIconEx, which returns the small icon of the resource, not one at the exact tray size like the app icon gets in ReadIconOfSize. Which would you prefer?
I'm happy to do either on this branch. |
|
Let’s add yours as a separate mode for now, maybe I'll remove the old mode later. Two things to change:
|
|
Sharing this icon here for reference, it may be useful in the future: a test icon with frames of 64, 48, 40, 32, 28, 24, 20 and 16 px, each one showing its own size as a number, so it's easy to check which frame Windows gives at each DPI scale. I'll test the changes in a couple of hours in my environment and report back after committing. |
|
Pushed a5bf657. The system icons are now read with I added tests for the size read from a file and for the converter's glyph choice. I tested it with the numbered icon above at different display scales. On my Windows 10, the tray shows:
bandicam.2026-11-03.10-39-57-641_new.mp4One thing I noticed: the tray icon size is read once, when the icon is first loaded, so changing the display scale while Volumey is running isn't followed. That already happens with the app icon, so I left it out of this PR. It could be handled in another one. |
Thanks, done in 9b6f833. On a light taskbar, only what a flood fill reaches from the edge through pixels without a color of their own (channels within 0x40) is inverted, so the red badge of the no-device icon and what it encloses should keep their colors. I added tests with a white glyph that has a red badge with a white dot inside. I also tested it locally with a custom icon for a muted device: badge-glyph-test.zip The following image is a representation, not a screenshot, of the result on a dark taskbar (left) and a light taskbar (right). The real result is practically the same.
One addition on top of the suggestion: the fill result is only inverted if it is white, so a custom gray or black icon is left as it is, instead of turning white on a light taskbar. |
|
Nice! Mostly ready to merge then, needs merging actual main and after merging: #131 re-runs the tray binding on a scale change, but the system icons are cached per state at the first size, so they stay blurry. Keep one dark/light SystemIconProvider pair per tray size (a Dictionary<int, (Dark, Light)> keyed by getTraySize()), created with type => LoadFromSystem(type, size); a new size then gives a new provider, and your currentIconProvider != systemProvider check sends the icon again. |
|
Implemented the per-size system icon cache.
When the display scale changes, #131 triggers the tray binding again. The converter detects the new size, creates a new provider pair and sends the correctly sized icon to the tray. Previously used sizes reuse their cached providers. I've also added a test covering provider creation on a new size and reuse when switching back to a previously cached size. ✅ I tested DPI scaling changes on Windows 10 while Volumey is running to verify that the system icons automatically adjust to the correct size at each scale. Used icon from: #129 (comment) Note: The two UI test failures on commit 80a2c67 were transitory and unrelated to my changes: one was an OSD binding error during test cleanup, and the other was a failure to open the Sound Control Panel. Both tests passed in the subsequent run without any code changes. |
|
Awesome, thank you very much |



What
Adds a fourth value to the Tray icon setting (General page): Windows volume icons. With it, the tray shows the glyphs of Windows' own volume icon instead of Volumey's, for the same states (high, mid, low, zero, mute, no device). The glyphs are read from the system file at runtime, so a set that has been patched on the PC (customized volume icons) shows up in the tray as well.
I use customized system volume icons and wanted Volumey to keep showing them. A "pick your own icon" option seemed far too complicated, so this reuses what Windows already has.
How
TrayIconKind.SystemIconsis the new setting value (saved as"TrayIcon": "SystemIcons"), added toAppBehaviorViewModel.TrayIcons. The settings list stays a plain combo box.TrayIconConverter.SystemIconProvider, aTrayIconProviderlike the light and dark ones. It reads each glyph once (also when it fails) withIconHelper.GetFromDll, using a negative index, whichExtractIconExtreats as a resource ID.%windir%\SystemResources\SndVolSSO.dll.mun(the folder comes fromEnvironment.SpecialFolder.Windows). The icons are in that file, not inSystem32\SndVolSSO.dll.SystemIconProvider.ResourceIds. Tested on Windows 10:IconType.Zero.Pickreturns it only for this option; the other options behave as before (zero is still "low").TrayIcon_SystemIconsin every.resx. The translations are mine, not native; please check them if you have someone for those languages.Tests
Pick: same glyph as the volume level option, exceptZerofor a volume of zero.TrayIconsoffers everyTrayIconKindvalue; the choice is saved and read at start and loaded fromsettings.json.EveryLanguageTranslatesEveryStringalready covers the new string in all languages.Tested on
Only Windows 10, with the default icons and with a customized set. I haven't been able to check it on Windows 11.
The small icon from
ExtractIconExis used, not the exact tray size the app icon gets inReadIconOfSize. If you want that for the system icons too, that needs a change on top.Windows 11
If the icons are somewhere else there, only these need to change, in
SystemIconProvider.cs:ResourceFileName(nowSndVolSSO.dll.mun, in%windir%\SystemResources) if the file has another name or location there.ResourceIds, the icon group ID of each state.To find them, open
C:\Windows\SystemResources\SndVolSSO.dll.munin Resource Hacker (look at the Icon Group entries as shown in this screenshot). Then run the tests:EveryVolumeStateHasASystemIconResourcechecks the table andTheSystemIconsAreReadFromWindowsFilechecks that the real file gives an icon for every state.Feel free to change anything on top of my branch.