INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Stop screen dimming when watching video  (Read 2443 times)

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4272
Stop screen dimming when watching video
« on: August 09, 2022, 03:24:33 am »

Is there a setting in MC somewhere that ensures it sends appropriate signal to power management system to not dim the screen while playing video?

I can't find one and currently have to manually change settings before playback (using KDE 5.25 on Debian testing)

alternatively is this meant to work already but doesn't (on kde)?
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10970
Re: Stop screen dimming when watching video
« Reply #1 on: August 09, 2022, 03:42:15 am »

We use DPMS to disable power management when the screen is supposed to be kept on, as well as use the X11 Screen Saver API to turn that one off. This seems to work in some situations as well.

There might be other calls that we could do using D-BUS, but all this stuff is really not well documented, unfortunately.
Logged
~ nevcairiel
~ Author of LAV Filters

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4272
Re: Stop screen dimming when watching video
« Reply #2 on: August 09, 2022, 08:22:09 am »

xset -q tells me

Code: [Select]
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  0    cycle:  600

DPMS (Energy Star):
  Standby: 0    Suspend: 0    Off: 0
  DPMS is Disabled

so I guess DPMS is not involved for me anyway, do you have the exact X11 screensaver api used so I can google that to see how/if it relates to how kde works?
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10970
Re: Stop screen dimming when watching video
« Reply #3 on: August 09, 2022, 08:53:25 am »

We call XSetScreenSaver with a timeout of 0, which is supposed to turn off the screensaver, but your report already has a timeout of 0, so its supposedly already off as well.

I assume this output was without MC running, from a fresh desktop?

I cross-checked a few other open-source multimedia projects, and on a glance all I could find was using XSetScreenSaver and DPMS as well.
Logged
~ nevcairiel
~ Author of LAV Filters

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4272
Re: Stop screen dimming when watching video
« Reply #4 on: August 09, 2022, 08:54:59 am »

I gather that kde reacts to this api -> https://people.freedesktop.org/~hadess/idle-inhibition-spec/re01.html

it appears to have been around for some time and a few different linux setups implement it so seems a reasonable thing to attempt to use

could MC be extended to make use of this?

EDIT: not 100% sure this works locally (or it doesn't work using qdbus anyway...)
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4272
Re: Stop screen dimming when watching video
« Reply #5 on: August 09, 2022, 08:57:09 am »

I assume this output was without MC running, from a fresh desktop?
repeated on fresh boot and get the same output
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4272
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10970
Re: Stop screen dimming when watching video
« Reply #7 on: August 09, 2022, 09:26:24 am »

We don't integrate with DBus at all yet, so that'll probably take some time.
Logged
~ nevcairiel
~ Author of LAV Filters

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4272
Re: Stop screen dimming when watching video
« Reply #8 on: August 09, 2022, 09:28:48 am »

switched to using qdbusviewer to send the signal and can confirm kde does respect this Inhibit call (no clue why dbus-send or qdbus don't work at the shell but google suggests I'm not alone!)
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5241
  • "Linux Merit Badge" Recipient
Re: Stop screen dimming when watching video
« Reply #9 on: August 09, 2022, 08:31:36 pm »

So just chiming in to confirm mattkhan's observation that I've never had MC actually inhibit the screen from turning off or from suspending on Gnome, KDE, or XFCE.  I reported this a few years back I think, but some other folks indicated that it worked for them, so I assumed it was just something busted in my setup, but it sounds like at least one other person is seeing the issue.

FWIW I solved this problem at my house by writing a script as a work around to replace the system power management on my HTPCs because of this issue and some other issues with the default power-management behavior.  I disable suspend and screen blanking in Gnome/KDE/XFCE settings, and then just run my script using systemd-timers or cron.  The script is pretty basic, it just checks to see whether the system is a) not outputting sound (by checking the asound subdirectories under proc) and b) idle for more than some number of minutes.  If both a) and b) it suspends the system, otherwise, it does nothing.  This does what I want 99% of the time (i.e. keeps the computer on when music or video is playing), the only failure mode being if I put on a long playlist and walk away the computer will keep going for hours, but that's my fault really.

Obviously, I would prefer if MC could natively prevent screen turn off/suspend, but, honestly, browser video and some other software I use have the same problem interfacing with my DE's power management on Linux (e.g. if I'm watching a streaming film in the browser, the browser doesn't seem to prevent the screen from turning off either).  So while my script is a kludge, it solves both MC and the browser/other use case too. As dumb as it is, I actually prefer it to Linux-native power management  ::) .
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4272
Re: Stop screen dimming when watching video
« Reply #10 on: August 10, 2022, 01:58:55 am »

thanks for confirming you see similar behaviour

Obviously, I would prefer if MC could natively prevent screen turn off/suspend, but, honestly, browser video and some other software I use have the same problem interfacing with my DE's power management on Linux (e.g. if I'm watching a streaming film in the browser, the browser doesn't seem to prevent the screen from turning off either). 
fwiw this does work in my case (e.g. watching youtube in chrome or firefox or playing a video in smplayer/mpv) so for me it's just MC that has a problem (on what appears to be pretty much vanilla debian/kde system)
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13940
Re: Stop screen dimming when watching video
« Reply #11 on: December 16, 2022, 07:49:00 pm »

I assume you did turn in the option in MC's audio options to not disable HDMI during playback?
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5241
  • "Linux Merit Badge" Recipient
Re: Stop screen dimming when watching video
« Reply #12 on: December 16, 2022, 09:28:54 pm »

I assume you did turn in the option in MC's audio options to not disable HDMI during playback?

In my case, yes I tried that option, but it doesn't seem to make a difference on any of my systems.  For reference all my systems run either Gnome or Xfce4.  Most of those are on Debian 11.
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13940
Re: Stop screen dimming when watching video
« Reply #13 on: December 17, 2022, 10:06:56 am »

In my case, yes I tried that option, but it doesn't seem to make a difference on any of my systems.  For reference all my systems run either Gnome or Xfce4.  Most of those are on Debian 11.
Works perfectly for me in Buster xfce4
The call is pretty simple
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5241
  • "Linux Merit Badge" Recipient
Re: Stop screen dimming when watching video
« Reply #14 on: December 17, 2022, 08:51:44 pm »

Works perfectly for me in Buster xfce4
The call is pretty simple

Can you tell me what your xfce4 power management settings are like so I can try to replicate?  I've been tinkering with this for a while and I've never had MC successfully inhibit screen turn off or suspend with xfce, so if there's a combination of settings that works I'd be be happy to adopt it! 

Does it work for you with Gnome as well?
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13940
Re: Stop screen dimming when watching video
« Reply #15 on: December 22, 2022, 05:14:20 pm »

Can you tell me what your xfce4 power management settings are like so I can try to replicate?  I've been tinkering with this for a while and I've never had MC successfully inhibit screen turn off or suspend with xfce, so if there's a combination of settings that works I'd be be happy to adopt it! 

Does it work for you with Gnome as well?
I just use stuff straight out of the box without reconfiguing the power managment.

MC uses these commands for power management on linux
Code: [Select]
XResetScreenSaver(GetJRUI()->GetDisplay()); // keeps the screensaver from activating.

For disabling the monitor shutoff IF DPMS is supported:
Code: [Select]
DPMSDisable(GetJRUI()->GetDisplay()); // disables monitor DPMS

Also MC will run this conditionally
Code: [Select]
XSetScreenSaver(GetJRUI()->GetDisplay(), 0, m_nInterval, m_nPrefer_blanking, m_nAllow_exposures); // 0 as the second arg disables the screensaver. The other values are the default which the ScreenServer returned as its defaults.

The setting of these are logged.
Logged
Pages: [1]   Go Up