digitaltrails / vdu_controls

VDU controls - a control panel for monitor brightness/contrast/...
GNU General Public License v3.0
103 stars 4 forks source link

Panel Icon - Dark/Light-Mode #66

Closed avnibilgin closed 8 months ago

avnibilgin commented 8 months ago

Dear developers, I really like your really very useful app and thank you for your work. But I'm still annoyed about one little thing. Why do they change their panel icon so often? Why is the icon hardcoded? And why aren't monochrome icons offered for light and dark modes? As a Linux user with a nice monochrome panel, your icon is inappropriate and strange. Every week after an update I have to adjust my icons. Here is a photo of my desktop where I customized your icon. Best regards and thank you for your great work!

image

digitaltrails commented 8 months ago

Dear developers, I really like your really very useful app and thank you for your work.

Thanks.

But I'm still annoyed about one little thing. Why do they change their panel icon so often?

The panel icon overlays the:

  1. icon for the current Preset,
  2. the Preset transitioning indicator (green flashing dot),
  3. and the indicator for auto-brightness/lux adjustment (steady orange dot when enabled).

So it is regenerated to incorporate these other indicators, as can be seen here:

Screenshot_20231021_131353

Screenshot_20231021_133143

A slowly transitioning Preset would flash a green indicator, similar to the orange one, on the left side of the icon until the transitioning finishes. If Presets don't have any transitions set, you'd never see the green indicator. Similarly, if you don't enable lux-metering, no orange indicator will be visible.

Why is the icon hardcoded?

An attempt is made to load the basis for the icon from /usr/share/icons/hicolor/256x256/apps/vdu_controls.png, if that fails an embedded jpeg is used instead. If it was desired, code could be added to try loading it from $HOME/.config/vdu_controls/vdu_controls.png first. The reason it's a PNG is the file is actually the source for the splash-screen and the icon is just a shrunken version of that.

And why aren't monochrome icons offered for light and dark modes? As a Linux user with a nice monochrome panel, your icon is inappropriate and strange. Every week after an update I have to adjust my icons. Here is a photo of my desktop where I customized your icon.

Mainly because no one has asked for such a feature. I have not used a monochrome desktop since the 1990s, for a while I used an hardware "X-Terminal"/X-Server with a monochrome CRT, but not since, so it's not on my personal radar :-)

Some aspects of the icon used to be modified for light and dark modes, but that caused problems with the visibility of the overlays. For a monochrome icon to work well with the overlaid Preset symbols/abbreviations, it should probably always have a lighter color screen.

Best regards and thank you for your great work!

The easiest thing to do would be to an extra search path for the icon: $HOME/.config/vdu_controls/vdu_controls.png. The you'd be free to make it work with your own designs for Preset icons.

avnibilgin commented 8 months ago

I used incorrect definitions regarding the terms “monochrome” and “panel”. By “Monochrome” I actually meant black/white icons and by “Panel” I meant the top bar of a desktop environment like KDE, Gnome or XFCE. I apologize for the misunderstanding.

The easiest thing to do would be to an extra search path for the icon: $HOME/.config/vdu_controls/vdu_controls.png. The you'd be free to make it work with your own designs for Preset icons.

Implementing an additional search path would be great! This would solve the customizing problem. I would like to thank you for the very detailed and quick answer.

I wish you much success with your great app, which I use every day. It has a great health effect on my eyes and makes my work and the work of many other people in front of the monitor easier.

digitaltrails commented 8 months ago

I used incorrect definitions regarding the terms “monochrome” and “panel”. By “Monochrome” I actually meant black/white icons and by “Panel” I meant the top bar of a desktop environment like KDE, Gnome or XFCE. I apologize for the misunderstanding.

I think I understood this correctly. I experimented with adding a second embedded monochrome app icon. It's very easy to add boolean options, so I added a monochrome tray option to enable it:

image

It's themed, and adjusts to dark/light theme changes immediately in KDE:

Screenshot_20231021_173459

The orange auto-lux indicator would still appear if you turned auto on:

Screenshot_20231021_174416

It was a little tricky getting a icon that overlaps nicely with the icons/abbreviations for presets, but I got there in the end.

The easiest thing to do would be to an extra search path for the icon: $HOME/.config/vdu_controls/vdu_controls.png. The you'd be free to make it work with your own designs for Preset icons.

Implementing an additional search path would be great! This would solve the customizing problem. I would like to thank you for the very detailed and quick answer.

If you would prefer to create your own icon, I can look into that. Otherwise I will tidy it up and push it - probably tomorrow local time.

I wish you much success with your great app, which I use every day. It has a great health effect on my eyes and makes my work and the work of many other people in front of the monitor easier.

Thanks. I only wrote it because I bought a new monitor. I soon discovered back-lights are a lot brighter now. That's great during the day, but the monitor gives me sunburn at night. So I thought I share the little script, now it's not so little :-)

I glad it's having a positive effect in your workplace. It's nice to get some feedback.

digitaltrails commented 8 months ago

I think there does need to be support for a user provided icon because I can't figure out how to deal with a desktop that is only dark themed inside the panel, but light-themed everywhere else, an example being the KDE Breeze-Twilight theme.

digitaltrails commented 8 months ago

OK, I've check in code that offers both routes. Either switch on monochrome tray in settings, or supply a $HOME/.config/vdu_controls/app_icon.svg file.

There are a three suitable svg files in icons one called

  1. app_icon.svg (for light themes)
  2. app_icon_white.svg (for dark themes)
  3. app_icon_white_middle.svg (for dark-panel-light-desktop themes)

Switching on monochrome tray works well for full on light or dark screen desktops.

A custom icon kind of works best for dark-panel-on-light-desktop themes. But if falls short when overlaying info onto the icon because the light-desktop forces dark overlay. This can be worked around by using a icon with a white middle, such as app_icon_white_middle.svg (but I think it's an ugly icon, maybe it can be improved).

I need to think about how to handle that. Maybe a metadata hint in the svg file might work. But implementing that blows the current simplistic theme handling code out of the water.

The advantage of the original color icon is it steps around the whole business.

digitaltrails commented 8 months ago

Idea: Inspect the icon to find out if the fill color is dark or light * is_icon_dark(icon: QIcon) - use appropriate overlays.

App Icon could be automatic/embedded if there was a setting monochrome-tray = black-on-white/white-on-black.

avnibilgin commented 8 months ago

All new icons look really great! Both the light and dark modes look very good. As a long-time Arch KDE Plasma user, I find the icons ideal for a plasma system tray.

image image image

I think there does need to be support for a user provided icon because I can't figure out how to deal with a desktop that is only dark themed inside the panel, but light-themed everywhere else, an example being the KDE Breeze-Twilight theme. OK, I've check in code that offers both routes. Either switch on monochrome tray in settings, or supply a $HOME/.config/vdu_controls/app_icon.svg file.

It's really great that you found a solution for this too, because I have a desktop theme exactly like this. My panel icons are white, my application icons are dark, like Breeze Twilight.

And it's particularly good that the icons are in svg format, because svg icons look much better in KDE Plasma panels. PNG images are slightly distorted in color.

I'm already looking forward to the next update! Thank you very much for your effort.

digitaltrails commented 8 months ago

It's really great that you found a solution for this too, because I have a desktop theme exactly like this. My panel icons are white, my application icons are dark, like Breeze Twilight.

And it's particularly good that the icons are in svg format, because svg icons look much better in KDE Plasma panels. PNG images are slightly distorted in color.

I'm already looking forward to the next update! Thank you very much for your effort.

This morning I decided to bite the bullet and introduce another setting mono-light-tray to go along side monochrome-tray. This will enable the code to do the right thing for "Twilight-like" desktops without the user needing to manually create any icons.

I thought about having one setting, a combo-box, but the settings code doesn't support that, rather than doing a lot of work I'll just use two boolean settings.

I'm also going to leave in the code for a custom icon - just in case someone has a really wacky theme and they need an override.

All coded, seems to work, but still testing.

avnibilgin commented 8 months ago

I thought about having one setting, a combo-box, but the settings code doesn't support that, rather than doing a lot of work I'll just use two boolean settings.

Exactly, you don't need more than one boolean setting, such as „light mode“ (true) / „dark mode“ (false).

I'm also going to leave in the code for a custom icon - just in case someone has a really wacky theme and they need an override.

This means that all use cases are covered. Excellent.

digitaltrails commented 8 months ago

All checked in.

Changes should become apparent when the settings are saved, immediately after the application reloads (there is no need to restart).

If needed, the override file is now a SVG that should be named $HOME/.config/vdu_controls/tray_icon.svg. The content of the file is assumed to be for a dark theme, and white or breeze-white will be automatically be changed to black if monochrome-tray is enabled (so the same file can cover dark and light). A starter override file is in icons/tray_icon.svg (editable with inkscape).

avnibilgin commented 8 months ago

Great job! Updated your script and added the icons to the correct folders. Here is the result after restarting the computer (and setting it to monochrome). Thanks alot!

2023-10-22_125821

digitaltrails commented 8 months ago

Great job! Updated your script and added the icons to the correct folders. Here is the result after restarting the computer (and setting it to monochrome). Thanks alot!

Your desktop looks good. It clearly demonstrates the need for monochrome tray icon, the icon fits right in.

In your case, you shouldn't need any special icons. Try removing $HOME/.config/vdu_controls/tray_icon.svg and in Settings turn on monochrome tray enabled. That should do the trick. If that isn't the case, that would be a bug.

avnibilgin commented 8 months ago

I did it directly without tray_icon.svg anyway and as you explained, enabled the monochrome tray setting. I just copied the tray_icon.svg to the icons folder (as a template). I also tried a custom icon, so I saved it directly in the config folder under the name tray_icon.svg. This also worked wonderfully.

digitaltrails commented 8 months ago

I did it directly without tray_icon.svg anyway and as you explained, enabled the monochrome tray setting. I just copied the tray_icon.svg to the icons folder (as a template). I also tried a custom icon, so I saved it directly in the config folder under the name tray_icon.svg. This also worked wonderfully.

Great. Thanks for testing all the options.

digitaltrails commented 8 months ago

Released in v1.20.0.