NiyaShy / XB1ControllerBatteryIndicator

A tray application that shows a battery indicator for an Xbox-ish controller and gives a notification when the battery level drops to (almost) empty.
GNU General Public License v2.0
730 stars 52 forks source link

Tray icon hard to see on 1903 with the light theme #23

Closed timocapa closed 5 years ago

timocapa commented 5 years ago

Pic

Maybe have it invert like Windows's own icons when the light mode is enabled?

Otherwise seems to work without issues so far! :)

illusive-man commented 5 years ago

Totally disagree. What about Dark windows theme? Being inverted it will be like dark grey on black... Not sure that's good idea until there are two sets of icons for both modes.

timocapa commented 5 years ago

You misread my first sentence.

Windows inverts the system icons when switching themes.

See Ethernet and Audio icons a

illusive-man commented 5 years ago

I did. Sorry, my bad. )) In this case that would be awesome!

NiyaShy commented 5 years ago

Hey, I see what you mean, but let me be honest, I never would have expected that anyone actually wants to use light mode... *insert April fools joke about Discords light theme here* That the system-side icons switch is kind of to be expected, but I'm not sure if a program can even notice when the theme changes. And I also see that Discord avoided problems by adding a slight shadow/border around the icon. When I find the time and motivation I'll see if I can edit the icons so they have a dark border for more contrast. But that will be 50 edits (25 icons x 2 resolutions)...

timocapa commented 5 years ago

I see what you mean, but let me be honest, I never would have expected that anyone actually wants to use light mode... insert April fools joke about Discords light theme here

I, in fact, do prefer using light mode in most stuff throughout the day as I find it to be easier on the eyes. Night and everything is dark ;)

That the system-side icons switch is kind of to be expected, but I'm not sure if a program can even notice when the theme changes

I'm not sure if the Auto Night Mode Switcher thing would help in reading the status? -> https://github.com/Armin2208/Windows-Auto-Night-Mode


While we're at it, perhaps a small enhancement would be allowing only a single instance. As of now you seem to be able to run multiple instances, which I don't think makes sense. Perhaps worth a new issue post?

NiyaShy commented 5 years ago

Hey, since reworking all icons, especially the "old" 16x16 ones, would be a real PITA, I would instead opt for just removing the alpha channel (aka, transparency) from the icons and replacing their background with a solid color. Won't look as nice any more, but it should improve visibility in light theme. Here's a test version where I replaced the "no controller found" icon with a version that has solid black as background. XB1ControllerBatteryIndicator_1.3.1_IconTest.zip

And about multiple instances: true, there's nothing that checks for that. But then again, running it more than once does no harm, the worst that could happen is that you get multiple low battery warnings. I looked into ways for preventing a second start, but they are... rather complicated...

timocapa commented 5 years ago

It, indeed, does not not look nice. image

timocapa commented 5 years ago

Inverting the icons isn't an issue and would only take a few minutes, but I don't know how to autochange the icon theme with Windows.

image

timocapa commented 5 years ago

Maybe this? https://stackoverflow.com/questions/51334674/how-to-detect-windows-10-light-dark-mode-in-win32-application

timocapa commented 5 years ago

inverted all icons (and layers), i dont know how to actually code, though..

https://github.com/timocapa/XB1ControllerBatteryIndicator/commit/35f723ee7d54ce8b4e06c28ce842f9d39add2d75

explorer_ZHMxt3y86C explorer_8dBI0cJIxL

NiyaShy commented 5 years ago

Thanks, didn't think of inverting them. Your link goes in the right direction, but it seems to be for C++ while the program is written in C#. Something like this might work, I'll see what I can do.

timocapa commented 5 years ago

Thanks, didn't think of inverting them.

Kein Problem 😄

I'll see what I can do.

Danke :)

NiyaShy commented 5 years ago

One thing I'd need to know before I start to tinker: could you please check for me if a certain registry key changes when you switch between light and dark mode? I'm still running on 1809, so can't check it myself. The key is under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize and is called AppsUseLightTheme. I fear this key is "just" for the light/dark app mode that was implemented in (I think) one of the 180x releases, but not the actual light/dark theme switch. Since 1903 is still brand new I can barely find info about detecting the theme switch.

timocapa commented 5 years ago

There are two keys in that path, AppsUseLightTheme and SystemUsesLightTheme that both get switched (as I am changing both) when I change the theme. You'd probably want "SystemUsesLightTheme"

RMmRgpvEmC

(I've already had that GIF recorded earlier :))

NiyaShy commented 5 years ago

Ah, nice, so it seems to be SystemUsesLightTheme then. Don't have that key on 1809 yet. But since it's stored in the same place I should be able to tinker something together that works similar to detecting the light/dark app mode switch.

timocapa commented 5 years ago

Feel free to message me if you want me to test things

NiyaShy commented 5 years ago

Here you go, this test build should auto-detect the current theme and switch to the (non)inverted icons accordingly. XB1ControllerBatteryIndicator_1.3.1_LightThemeSwitch.zip

timocapa commented 5 years ago

Not the fastest, but it certainly works!

iCgUTkBmTN

NiyaShy commented 5 years ago

Guess it's delayed because controller polling only happens every 1-5 seconds and that's currently what changes the icon, so it only updates after the next poll is finished. I'll tinker some more, at least we're getting there ;)

timocapa commented 5 years ago

Good to know, I guess - Thanks! I think I can close this now? :)