Skip to content

Prototype detecting fullscreen apps to override brightness #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xPaw
Copy link

@xPaw xPaw commented Feb 3, 2025

Depends on #47.

I prototyped the code to detect fullscreen foreground windows on Windows systems.

This appears to work on my machine with two screens, whenever switching to an app that is fullscreened on either screen. When switching to another non-fullscreen window, it drops brightness.

I'm calling this a prototype, because it currently just calls "pause" which forces day brightness on all monitors, but for this feature I'd want it to only change brightness of the monitor that has the fullscreen window. It probably also needs a setting for users to disable this feature, and maybe set custom brightness.

For only changing brightness of one screen, I am unsure how to implement this well. One day I had in mind is just get the device id/path and create an override similar to how you can do that in GUI.

@@ -116,7 +143,10 @@ unsafe extern "system" fn wndproc(
wparam: WPARAM,
lparam: LPARAM,
) -> LRESULT {
if let Some(window_data) = window.get_user_data::<WindowData>() {
let window_data_ptr = GLOBAL_WINDOW_DATA.load(Ordering::SeqCst);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to change this because the win_event_hook_proc I added doesn't have a handle to our window.

@xPaw xPaw force-pushed the fullscreen branch 2 times, most recently from c7fbb86 to 0324814 Compare February 4, 2025 11:42

let window_data = &mut *window_data_ptr;

// TODO: This is likely to be buggy on multi monitor setups when both monitors have fullscreen apps open
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a tricky case to handle, but having one global bool for fullscreen is wrong, as it's possible to get it stuck in wrong case when switching from fullscreen app on one monitor, to non-fullscreen app on another.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant