0

My question isn't how to prevent screen locks/screen turning off / suspend, that question is answered here: Prevent screen locking while watching videos

My question is shouldn't this be solved on an OS level? Doesn't the OS know whether a video is playing? Or have an API that an application can prevent suspension? Shouldn't the OS have options in its Power settings for this?

Approaches like LightOn.sh, check running processes for specific applications. It, for example, has separate checks for fullscreen flash and the HTML 5 video player for specifically Firefox, Chromium, Chrome, Opera etc. It requires checks for specific video players. That seems very fragile and not scalable?

Is the reason may be that it's a security concern? That is an application can prevent a screen lock it leaves a computer more prone to intrusion?

1

TL;DR It's up to apps to tell the system that they want to block sleep

The problem is that there's no way to know the semantic content of an audio or video stream without the app declaring it. You and I know that we don't want the computer to suspend in the middle of a movie, but the computer doesn't know the difference between a movie and a visualizer or white noise or some other kind of background stream that we don't care about interrupting. As far as the computer is concerned, they are the same thing. So it's up to the app playing audio or video to know what their purpose is semantically and to block sleep when appropriate.

  • Very good point. But, is that possible in Linux? Why wouldn't Videos, Youtube etc declare this? I'm also thingking of opening an issue at the power settings repo since it might be interesting for users to be able to add applications. The tricky thing is, that it's usually applications that are in a certain mode, it's not simply that the Videos app is running, it's that it's playing video, it's not simply a browser, but a browser playing video. – Peter Uithoven Nov 18 '17 at 0:37
  • In Videos code I now see a workaround to prevent suspend by simulating user activity... github.com/elementary/videos/blob/master/src/Services/… Which sort of points to the direction that there isn't a good way to prevent suspend in general yet? – Peter Uithoven Nov 30 '17 at 1:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.