X11 regression: mpv no longer prevents screen lock
mpv version and platform
mpv version: 0.26.0-140-g1a1f6e8581
Kubuntu 17.04 with KDE Plasma 5.9.4
Reproduction steps
-
In system settings, set the screen lock delay to some small value (like 1 min)
-
Start playing some video with mpv
-
Wait for a specified time without keyboard/mouse events
Expected behavior
mpv should prevent the system from locking the screen when video is being played.
Actual behavior
The system automatically locks the screen.
The regression manifests itself since 3f75b3c3439241c209349908fa190c0382e44f05.
Log file
https://pastebin.com/4QRpbmEZ
The problem is a bug in xdg-screensaver making it not work on KDE's powerdevil
see https://bugs.freedesktop.org/show_bug.cgi?id=102124
good luck ever getting this fixed since Freedesktop thinks their shit being completely broken is just "minor"
If xscrnsaver helps you just add back, easy revert to maintain, at least for a while https://gist.github.com/mc4man/d4f183fd916515e6038654877070d3a1
@mc4man
If xscrnsaver helps you just add back, easy revert to maintain, at least for a while https://gist.github.com/mc4man/d4f183fd916515e6038654877070d3a1
Thanks. For the time being, I already reverted to the last release (0.26.0) which also works fine. I just hope that the problem will be eventually dealt with somehow.
Similar problem here.
mpv 0.26.0-151-gc6628a5fb-dirty with no DE.
It's funny, but now my screen goes black after 10 minutes or so. I can bring the picture back only by pressing a key. Watching long movies is now kinda annoying...
mc4man's patch fixes the issue.
Seems like this scrnsaver part is especially helpful with no screensaver installed.
@fhlfibh try installing xdg-screensaver.
@CounterPillow
Without the patch?
You mean xscreensaver or xdg-utils?
UPD.
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild N ] dev-libs/libatomic_ops-7.4.2::gentoo 113 KiB
[ebuild N ] x11-apps/xprop-1.2.2::gentoo 143 KiB
[ebuild N ] x11-apps/xset-1.2.3::gentoo 139 KiB
[ebuild N ] dev-libs/boehm-gc-7.4.2::gentoo USE="cxx -static-libs -threads" 1058 KiB
[ebuild N ] www-client/w3m-0.5.3-r9::gentoo USE="X ssl unicode -fbcon -gpm -gtk -imlib (-libressl) -lynxkeymap -nls -nntp -xface" L10N="-ja" 2127 KiB
[ebuild N ] virtual/w3m-0::gentoo 0 KiB
[ebuild R ] app-text/xmlto-0.0.26-r1::gentoo USE="text* -latex" 0 KiB
[ebuild N ] x11-misc/xdg-utils-1.1.1-r1::gentoo USE="-doc -perl" 289 KiB
Total: 8 packages (7 new, 1 reinstall), Size of downloads: 3866 KiB
7 packages only to let the monitor not to go black... Really, I prefer mpv's old code and mc4man's patch much, much better.
@fhlfibh no, I mean xdg-utils
@fhlfibh well you go tell that to the chucklefucks that complained about the xscreensaver dependency then
I have xdg-screensaver, but i was experiencing this problem until i did apply the mc4man's patch.
If you have xdg-screensaver and it doesn't work, then it's most likely the above-linked bug in xdg-screensaver.
If you do not have xdg-screensaver, then it's because mpv now solely relies on xdg-screensaver for this functionality, because of people like @teod0r in https://github.com/mpv-player/mpv/issues/4706
@CounterPillow actually, it was me https://github.com/mpv-player/mpv/issues/4404
But as far as I remember, first a) mpv had xscreensaver (and xinerama) configure options, but I never used them, and everything worked happily, nevertheless (https://bugs.gentoo.org/show_bug.cgi?id=617516).
Then b) these became hardcoded and configure options were gone. I pulled depended libs in, and it all worked well again.
Now it looks like I'm back in the position "a)" again, but this time it doesn't work for some reason...
Anyway, personally I have only a little idea about how all these screensavers work, I only noted an issue and that the patch fixes it.
@fhlfibh so you complained about the dependencies being there and wanted to disable them, and now you complain about them being gone?
Fuck this I'm out. I clearly cannot comprehend the enlightened intellect it takes to be a gentoo user.
@CounterPillow Being a gentoo user actually requires no intellect, only an ass to sit on. And I'm sitting on mine long enough. Anyway, that's how it goes in my case, shortly: First) xscreensaver option disabled, no deps -- it works Then) xscreensaver hardcoded, deps pulled in -- it works Now) xscreensaver stuff and its deps dropped -- it doesn't work. In other words, I'm complaining not about deps being gone, but about that now it doesn't work without them as it once used to... However, I don't believe that much can now be done about it except using the patch or pulling it's code back into mpv or using xgd-screensaver.
All that 'patch' does is revert the commit behind this, i.e. the way it was. What should happen is it should be reverted in master & any nonsense issues about the libxss dep (xscrnsaver.h) should be ignored or closed. xscrnsaver.h is not xscreensaver, just a little X11 protocol, period.
Well, after replacing the xdg-screensaver script with newer version, it works fine.
@cranes-bill What exactly "newer version" do you mean?
Not sure if I should open a new issue or keep going here... Anyway: After this commit https://github.com/mpv-player/mpv/commit/6694048272619b7f91d161c040b818ff63e65279 I again started having black screen after 10-15 minutes.
xdg-utils-1.1.2 doesn't help:
# cat mpv.log | grep -i screen
[ 46.573][v][vo/opengl/x11] Disabling screensaver.
[ 46.588][v][vo/opengl/x11] Updating screensaver failed (4). Make sure the xdg-screensaver script is installed.
[ 830.766][v][vo/opengl/x11] Enabling screensaver.
And the patch from above doesn't work anymore...
Yeah, they took what worked fine for 99% of users & now screwed it up but good. If https://github.com/mpv-player/mpv/commit/6694048272619b7f91d161c040b818ff63e65279 means one has to find some new xdg script then it's even stupider than the 1st minor screwup. Should of left well enough alone..
@mc4man Is is possible to make a new patch that replaces the recent commit with the old code?
Maybe the new xscrnsaver thing now works out Ok for someones, but for me personally all this screensaver story goes only from bad to worse, from its very beginning...
I can confirm that 6694048272619b7f91d161c040b818ff63e65279 doesn't fix the issue for me.
anyone affected by this, you must:
- install xdg-utils (obviously)
- if you are using KDE, apply this patch to
/usr/bin/xdg-screensaverto workaround https://bugs.kde.org/show_bug.cgi?id=383575:
--- a/xdg-screensaver
+++ b/xdg-screensaver
@@ -681,7 +681,7 @@
cleanup_suspend
}
-XPROP=`which xprop 2> /dev/null`
+XPROP=
check_window_id()
{
@@ -752,12 +752,12 @@
case "$1" in
suspend)
dbus-send --session \
- --dest=org.freedesktop.ScreenSaver \
+ --dest=org.freedesktop.PowerManagement.Inhibit \
--type=method_call \
--print-reply \
--reply-timeout=2000 \
- /ScreenSaver \
- org.freedesktop.ScreenSaver.Inhibit \
+ /org/freedesktop/PowerManagement/Inhibit \
+ org.freedesktop.PowerManagement.Inhibit.Inhibit \
string:$window_id \
string:xdg-screensaver \
| grep uint32 | cut -d ' ' -f 5 >| "$screensaver_file.cookie" \
@@ -769,10 +769,10 @@
if [ -f "$screensaver_file.cookie" ] ; then
value=`cat "$screensaver_file.cookie"`
dbus-send --session \
- --dest=org.freedesktop.ScreenSaver \
+ --dest=org.freedesktop.PowerManagement.Inhibit \
--type=method_call \
- /ScreenSaver \
- org.freedesktop.ScreenSaver.UnInhibit \
+ /org/freedesktop/PowerManagement/Inhibit \
+ org.freedesktop.PowerManagement.Inhibit.UnInhibit \
uint32:$value \
2> /dev/null
rm -f "$screensaver_file.cookie"
@@ -801,17 +801,12 @@
;;
reset)
- if [ -f "$screensaver_file.cookie" ] ; then
- value=`cat "$screensaver_file.cookie"`
- dbus-send --session \
- --dest=org.freedesktop.ScreenSaver \
- --type=method_call \
- /ScreenSaver \
- org.freedesktop.ScreenSaver.UnInhibit \
- uint32:$value \
- 2> /dev/null
- rm -f "$screensaver_file.cookie"
- fi
+ dbus-send --session \
+ --dest=org.freedesktop.ScreenSaver \
+ --type=method_call \
+ /ScreenSaver \
+ org.freedesktop.ScreenSaver.SimulateUserActivity \
+ 2> /dev/null
result=$?
;;