Open ntninja opened 10 years ago
In the meantime, here is a polyfill that implements the required methods and forwards them to MATE ScreenSaver: https://gist.github.com/alexander255/9b991816418e4e60ee7c
Please see also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=768326 possibly mate-session-manager mate-power-manager Thanks!
Would this be fixable anytime soonish ?
Looks related: https://bugs.launchpad.net/bugs/1019878
Looks related: https://bugs.launchpad.net/ubuntu-mate/+bug/1403503
Since @monsta linked to an issue with VLC above, I want to add that VLC successfully blocks the screensaver for me once I have selected the "Disable screensaver" setting in the Video section of the VLC preferences. I am using VLC 2.2.0 and Mate 1.8.2 on Arch. This may be relevant to someone trying to test this bug. VLC might not be a good choice for testing because I still see this bug when using other video players like Firefox with H264 or using caffeine (here is the equivalent bug for caffeine: https://bugs.launchpad.net/caffeine/+bug/1026411).
I tried the script @alexander255 provided. It ran without error but did not inhibit the screensaver in my testing. Anyone know how much work it would take to fix this issue? I'd like to help but know nothing about Mate/dbus development.
@willsALMANJ
That script will not actually become operational before it wasn't able to connect to MATE screensaver over dbus; if you don't get any feedback that means that is DOES NOT work! I've updated the script slightly to give a bit more feedback about what is going on. Please also try running mate-screensaver-command -a
to make sure MATE screensaver is actually running. Additionally you might want to install d-feet
and check which application (if any) has acquired the name org.freedesktop.ScreenSaver
on the session bus (since that is what applications will connect to if they want to inhibit the screensaver).
Workload estimate:
As mentioned in my opening post you'd just have to expose MATE screensaver's org.mate.ScreenSaver
interface on org.freedesktop.ScreenSaver
with the /ScreenSaver
and /org/freedesktop/ScreenSaver
object paths to enable native support for this feature. Most of your changes would happen in this file. MATE ScreenSaver still uses the dbus-glib API so you can't just adopt the current GNOME source code (that uses the more modern GDBus API).
You don't need to know a lot about any MATE internals, just take the current source file as a starting point and keep the calls into MATE screensaver's lower layers the way they are right now. You do need some knowledge of C/GObject, DBus in general and dbus-glib specifcally through.
The first thing to do would definitely to write an example dbus service that serves the org.freedesktop.ScreenSaver
interface using the dbus-glib API (basically the C equivalent of what my Python script does), then integrate that into the existing source code.
Let me know if you have any questions :-)
Umm.. @willsALMANJ I have also checked disabled screensaver from long time back but still the screensaver does not get blocked.
@alexander255 how to know using d-feet
. The man page is just 2 lines with no example or anything so it's not known. Could you guide so we may know if any application has acquired org.freedesktop.ScreenSaver
@shirishag75 Sure, follow this guide:
d-feet
org.freedesktop.ScreenSaver
(or whatever you're looking for) into the text field next to Filter: (2)Hope I could help! :-)
@alexander255 Okay, your script does work for me. I got feedback from it (and checked that it did block the screensaver) for both VLC and Firefox. I'm not sure why it didn't work before. I thought it might be that I needed to have the script running before opening the VLC or Firefox window, but now I can restart the script with Firefox running and then maximize a video and it still works. It didn't work with Google Chrome though.
I will try to review the links you provided and see what I can learn about dbus and MATE. If anyone wants to try this, don't let me discourage you as it will probably be a slow process for me. In the mean time, I found I could all of the functionality I needed from the lightson+.sh script at https://github.com/devkral/lightsonplus (I had to tweak a few lines for it to recognize Chrome properly) and from alexander's script (other than Chrome).
@shirishag75 Yes, that is the setting that I checked in VLC. It works for me with the versions of VLC and MATE that I listed. I didn't do anything else to make it work. With that setting, the screensaver never activates for me when VLC is playing a video (VLC window does not need to fullscreen or even visible). If you use the same versions of the programs and it doesn't work, then I'm not sure what is going on. I see this behavior on Arch Linux. Perhaps the Arch packages use different build options from what you are using.
Hi all, These are the build options that the Debian people used while compiling as seen from vlc -vvvv (don't think anything else would give that) :-
[00000000019c5148] core libvlc debug: configured with ./configure '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--localstatedir=/var' '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--disable-dependency-tracking' '--build=x86_64-linux-gnu' 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-z,relro' '--config-cache' '--disable-maintainer-mode' '--disable-silent-rules' '--disable-update-check' '--enable-fast-install' '--prefix=/usr' '--docdir=/usr/share/doc/vlc-nox' '--libdir=/usr/lib' '--sysconfdir=/etc' '--with-binary-version=1' '--enable-a52' '--enable-aa' '--enable-bluray' '--enable-bonjour' '--enable-caca' '--enable-chromaprint' '--enable-dbus' '--enable-dca' '--enable-directfb' '--enable-dvbpsi' '--enable-dvdnav' '--enable-faad' '--enable-flac' '--enable-fluidsynth' '--enable-freerdp' '--enable-freetype' '--enable-fribidi' '--enable-gles1' '--enable-gles2' '--enable-gnutls' '--enable-jack' '--enable-kate' '--enable-libass' '--enable-libmpeg2' '--enable-libxml2' '--enable-lirc' '--enable-live555' '--enable-mad' '--enable-mkv' '--enable-mod' '--enable-mpc' '--enable-mtp' '--enable-mux_ogg' '--enable-ncurses' '--enable-notify' '--enable-ogg' '--enable-opus' '--enable-pulse' '--enable-qt' '--enable-realrtsp' '--enable-samplerate' '--enable-schroedinger' '--enable-sdl' '--enable-sftp' '--enable-shine' '--enable-shout' '--enable-skins2' '--enable-speex' '--enable-svg' '--enable-taglib' '--enable-theora' '--enable-twolame' '--enable-upnp' '--enable-vcdx' '--enable-vdpau' '--enable-vnc' '--enable-vorbis' '--enable-x264' '--enable-zvbi' '--with-kde-solid=/usr/share/kde4/apps/solid/actions/' '--disable-decklink' '--disable-dxva2' '--disable-fdkaac' '--disable-gnomevfs' '--disable-goom' '--disable-libtar' '--disable-mfx' '--disable-opencv' '--disable-projectm' '--disable-sndio' '--disable-svgdec' '--disable-telx' '--disable-vpx' '--disable-vsxu' '--disable-wasapi' '--enable-alsa' '--enable-atmo' '--enable-dc1394' '--enable-dv1394' '--enable-linsys' '--enable-omxil' '--enable-udev' '--enable-v4l2' '--enable-libva' '--enable-vcd' '--enable-smbclient' '--disable-oss' '--enable-crystalhd' '--enable-mmx' '--enable-sse' '--disable-neon' '--disable-altivec' 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security' 'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security' 'build_alias=x86_64-linux-gnu' 'OBJCFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security'
Sorry for the long output but that's how it is.
@shirishag75 The discussion of your problem with VLC should probably be taken to a different place since it is not related to changing MATE ScreenSaver to follow the freedesktop standard for DBus registration. That said, you still haven't specified what version of VLC you are using. You reference Debian which usually maintains quite old packages unless you are using the unstable version. I'm not sure how old the versions of VLC are in Debian release/testing/unstable, but explicit MATE support was added to VLC on May 27, 2013 here:
https://git.videolan.org/?p=vlc.git;a=commitdiff;h=0b1ef649c51148cc7bd8ac2573be33b6c3d26592
I would guess this code first appeared in a stable release of VLC in version 2.1.0.
I thought I had already shared that, this is the version I have :-
[$] vlc --version
VLC media player 2.2.0-rc2 Weatherwax (revision 2.2.0-rc1-118-g22fda39)
VLC version 2.2.0 Weatherwax (2.2.0-0-g1349ef2)
Compiled by skipper on deep-thought (Apr 6 2015 19:30:31)
Compiler: gcc version 4.9.2 (Debian 4.9.2-10)
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute it under the terms of the GNU General Public License;
see the file named COPYING for details.
Written by the VideoLAN team; see the AUTHORS file.
Ok, the situation with VLC is clear, modern versions have MATE support.
I guess we still need to add org.freedesktop.*
stuff and maybe also org.gnome.*
stuff for other apps.
@alexander255: are you sure it should be done here and not in mate-session-manager
? VLC commit posted above references only org.mate.SessionManager
.
@monsta I've reviewed the source code a bit and found that MATE screensaver basically just proxies MATE session's inhibitors (but does remember locally which programs currently hold a lock as well): https://github.com/mate-desktop/mate-screensaver/blob/edb89a74aa0440cd0f59bddf9205d50d91634e2d/src/gs-listener-dbus.c#L786
Also MATE screensaver then uses MATE session to determine when to consider the user session idle/start the screen lock timer: https://github.com/mate-desktop/mate-screensaver/blob/master/src/gs-watcher-x11.c#L436
Some observations:
org.mate.SessionManager.Inhibit
or org.mate.ScreenSaver.Inhibit
.org.mate.SessionManager.Inhibit
the lock will not be shown by org.mate.ScreenSaver.GetInhibitors
(as MATE ScreenSaver will not know about it).org.mate.ScreenSaver.Inhibit
method is identical (in terms of parameters) to the org.freedesktop.ScreenSaver.Inhibit
method that we are trying to implement. The org.mate.ScessionManager.Inhibit
method is made for a more generic use-case.While it's your call which daemon you choose to "burden" with this task, I'd still go for MATE ScreenSaver, since
@infirit: should we add this to roadmap for 1.12?
We can add it to the roadmap, not sure if 1.12 is realistic but why not.
I do like to stay as close to gnome so this has to be in settings-daemon as a plugin. This allows us to easily pickup code/fixes from there in the future.
ping....any update on this ?
All apps using org.mate.SessionManager
had been switched to org.gnome.SessionManager
in 1.12.
No work on Freedesktop interface done yet. Pull requests are welcome...
I found this solution: I installed gnome-session, login to gnome, logout, and login to mate again, then mate uses gnome inhibitor
@luciomoreira that is not really a solution but a hack but a terrible one at that. The whole idea of MATE is a low-cost, low-memory desktop environment. If I or anyone for that matter could use GNOME comfortably (meaning high memory and CPU usage) than why would anybody use MATE.
A part of the reason is also that it looks / shares GNOME 2 like-look which old-timers like.
I do hope that 1.20.0 does use this. For now I have made an alias which tells me that the specific function inhibit
in mpv will go away soonish and will have to rely on MATE for inhibition support.
[$] alias mpv
mpv=$'mate-session-inhibit --inhibit\n/usr/bin/mpv'
No programmer hence will stop here.
I think mate-screensaver should implement the freedesktop screensaver api. Although it's only a draft, it's the fact standard, both gnome and KDE implement it, and many application call this org.freedesktop.screensaver
dbus api to lock/unlock/inhibit/uninhibit screen lock.
@ntninja the gist is no longer available. Bountysource is also not available. Anyone here willing to collaborate on this?
Looking at this issue for quite a while, I think mate should just remove org.mate.ScreenSaver in favor of org.freedesktop.ScreenSaver in the places it's found.
I understand too little how gdbus work to do it myself.
Some interesting discussion found here:
https://bugzilla.mozilla.org/show_bug.cgi?id=1168090
Especially interesting are the comments from xfce4 developers.
If you want to see how firefox inhibits the screensaver:
https://hg.mozilla.org/mozilla-central/file/tip/widget/gtk/WakeLockListener.cpp
It turns out that the fix is very easy:
https://github.com/mate-desktop/mate-screensaver/compare/master...oz123:mate-screensaver:master
The hardest part was to compile the software and figure out that I need to install everything in the right path.
I believe this is related to my problem here, too: https://ubuntu-mate.community/t/xdg-desktop-portal-backend-call-failed/28467
Related: https://github.com/flatpak/xdg-desktop-portal-gtk/issues/472
GNOME and KDE already implement it and at least VLC and Firefox (33+) make use of it. It's not an "offical" Freedesktop specification but it has become a "defacto-standard". Link: http://people.freedesktop.org/~hadess/idle-inhibition-spec/
Things to do:
org.freedesktop.ScreenSaver
additionally toorg.mate.ScreenSaver
org.mate.ScreenSaver
) asorg.freedesktop.ScreenSaver
on the object paths/ScreenSaver
and/org/freedesktop/ScreenSaver
Inhibit
andUnInhibit
correctly!The reason why you have add both the
/ScreenSaver
and/org/freedesktop/ScreenSaver
object paths is because KDE orginally only added/ScreenSaver
while/org/freedesktop/ScreenSaver
fits into the official scheme. The spec fails to mention object paths entirly, but GNOME adds both paths so I guess that is what should be used... Also GNOME exports all for its ScreenSaver methods viaorg.freedesktop.ScreenSaver
althrough the spec only says you have to export theInhibit
andUnInhibit
methods so I guess that's how it should be done...