Skip to content
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

[Mac Catalyst] DeviceDisplay.KeepScreenOn not being respected on Mac OS #26059

Open
DanOrlovsky opened this issue Nov 22, 2024 · 1 comment
Open
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info platform/macOS 🍏 macOS / Mac Catalyst t/bug Something isn't working
Milestone

Comments

@DanOrlovsky
Copy link

DanOrlovsky commented Nov 22, 2024

Description

We have a Maui app targeting both Windows and MacCatalyst. There is a state the app can be in that requires us to keep the sceen on for the user so the app can function whether the user is at the computer or not.

To facilitate this, we are setting KeepScreenOn on DeviceDisplay:

await MainThread.InvokeOnMainThreadAsync(() =>
{
    DeviceDisplay.Current.KeepScreenOn = true;
});    

This is working fine in windows. The Mac build seems to be ignoring this setting completely.

Steps to Reproduce

Make sure your computer is set to sleep in a reasonable amount of time.

In a MacCatalyst maui app, set the DeviceDisplay.Current.KeepScreenOn to true.

Observe the screen will go to sleep.

Link to public reproduction project repository

https://github.com/DanOrlovsky/MauiBlazorNet9ScreenOnDemo

Version with bug

9.0.0 GA

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

MacOS 14 (Sonoma) and MacOS 15 (Sequoia) and both .Net 8 and .Net 9

Did you find any workaround?

No response

Relevant log output

@DanOrlovsky DanOrlovsky added the t/bug Something isn't working label Nov 22, 2024
@MartyIX
Copy link
Contributor

MartyIX commented Nov 22, 2024

If you would like to check the issue more in detail, I think these pointers can be helpful:

By compiling and running https://github.com/dotnet/maui/tree/main/src/Essentials/samples project, you would see what is not working, I believe.

To verify, what is going on, perhaps pmset -g (man) can be used to check if MAUI actually did something or not.

@jfversluis jfversluis changed the title [Mac Catalyst] DeviceDisplay.KeepScreenOn not being respected on Mac 0S, .net 8, .net 9. [Mac Catalyst] DeviceDisplay.KeepScreenOn not being respected on Mac OS Nov 22, 2024
@jfversluis jfversluis added platform/macOS 🍏 macOS / Mac Catalyst area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info labels Nov 22, 2024
@jfversluis jfversluis added this to the Backlog milestone Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info platform/macOS 🍏 macOS / Mac Catalyst t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants