xanderfrangos / twinkle-tray

Easily manage the brightness of your monitors in Windows from the system tray
https://twinkletray.com
MIT License
5.22k stars 169 forks source link

[Requests] Change monitor brightness when system brightness changed using WmiMonitorBrightnessEvent API #570

Open eiarhabi opened 1 year ago

eiarhabi commented 1 year ago

This issue extends upon #291.

Instead of directly hooking brightness keys, it seems much easier if we can adjust monitor brightness to values read from WMI whenever there's a change in monitor brightness. See here and here for some API documentations and a sample code from StackOverflow for asynchronously getting brightness change events.

vrjohannes commented 1 year ago

Wmi brightness functions only work with laptop-displays, external monitors are totally ignored,

xanderfrangos commented 1 year ago

Thanks for the links! Unfortunately, the samples aren't in C++, which is a requirement. C# or VB won't work for Twinkle Tray. I'll look around a bit more to see if I can find a C++ example for WMI events.

eiarhabi commented 1 year ago

Thanks for the links! Unfortunately, the samples aren't in C++, which is a requirement. C# or VB won't work for Twinkle Tray. I'll look around a bit more to see if I can find a C++ example for WMI events.

https://stackoverflow.com/questions/21476512/get-system-brightness-event-in-windows Here's a C++ example.

cerahmed commented 1 year ago

Dropping by to see if the suggested feature is planned for implementation. Any good news hopefully?

MF-JEWM commented 1 month ago

Dropping by to see if the suggested feature is planned for implementation. Any good news hopefully?

Hoping the same thing! Has this possibly been looked at for the current beta branch?

I can't currently find a way to change my Keychron Q1 HE to ouput the Screen Brightness Down (KC_BRID) and Screen Brightness Up (KC_BRIU) to control my monitors (PG27AQN, VG27AQ, and VN248). This feature would be amazing for use in conjunction with GMK.

(Note: GMK keycodes are listed in bold)

P.S. As someone not super knowledgeable on compsci I'll take this chance to ask since it was somewhat mentioned in the issue starter since it's tangentially related: do you need to have WMIC or WMI-Bridge on in order to properly take advantage of this feature (if it is or once it is implemented that is)? I ask since the starter mentions "adjust[ing] monitor brightness to values read from WMI whenever there's a change in monitor brightness".

superluig164 commented 4 weeks ago

I'd love to see this be added, allowing the system brightness to control monitors, basically the same way it works on a laptop. It would also allow Windows to automatically manage the brightness before falling asleep/turning off the screen.

xanderfrangos commented 3 weeks ago

I've looked into the Stack Overflow example linked above, but it's unfortunately not compatible with node-gyp. It uses newer C++ features than are compatible. At least, I can't get it to work.

Ideally, the code for this would expand upon the wmi-bridge module in Twinkle Tray (https://github.com/xanderfrangos/twinkle-tray/blob/master/src/modules/wmi-bridge/wmi-bridge.cc) or replace it entirely.