Screensaver when running Gnome under SDDM

We have machines running SDDM, the KDE/Plasma display manager. One user prefers Gnome as her desktop environment. There is no problem selecting that session when logging in. The screen however never turns off and goes to power save mode when the session is inactive. Apparently, the Gnome desktop environment requires GDM for full functionality.

Previously she started gnome-screensaver manually after logging in, but that program has been deprecated for a while, and is no longer part of the distribution. We have tried some other screensavers, but they seem to have problems, perhaps because they are made for the X11 environment and not working properly with Wayland. Xscreensaver for example starts drawing its saver screens, but does so even when the user is active! It never seems to enter the power save mode.

Does anyone know a solution for this? Is it possible to have the screen deactivated during inactivity when running a Gnome session but using SDDM as display manager? In our use case the actual locking isn’t important, but the power save mode of the monitor is.

Maybe setterm would work?:

Isn’t that for console mode only? In this case the Gnome desktop is used, and I don’t understand how setterm could help.

I thought it was using ACPI to turn off the monitor. If so, I think it should work in both text mode and from within a GUI. I could be wrong.

It looks like xset might be a better tool to use from within a graphical environment. There is a hint that it can be used in ACPI event handlers here: acpid - ArchWiki

Also, just running xset in my terminal shows what appear to be some promising options:

$ xset
usage:  xset [-display host:dpy] option ...
    To turn bell off:
	-b                b off               b 0
    To set bell volume, pitch and duration:
	 b [vol [pitch [dur]]]          b on
    To disable bug compatibility mode:
    To enable bug compatibility mode:
    To turn keyclick off:
	-c                c off               c 0
    To set keyclick volume:
	 c [0-100]        c on
    To control Energy Star (DPMS) features:
	-dpms      Energy Star features off
	+dpms      Energy Star features on
	 dpms [standby [suspend [off]]]     
	      force standby 
	      force suspend 
	      force off 
	      force on 
	      (also implicitly enables DPMS features) 
	      a timeout value of zero disables the mode 
    To set the font path:
	 fp= path[,path...]
    To restore the default font path:
	 fp default
    To have the server reread font databases:
	 fp rehash
    To remove elements from font path:
	-fp path[,path...]  fp- path[,path...]
    To prepend or append elements to font path:
	+fp path[,path...]  fp+ path[,path...]
    To set LED states off or on:
	-led [1-32]         led off
	 led [1-32]         led on
	-led named 'name'   led off
	 led named 'name'   led on
    To set mouse acceleration and threshold:
	 m [acc_mult[/acc_div] [thr]]    m default
    To set pixel colors:
	 p pixel_value color_name
    To turn auto-repeat off or on:
	-r [keycode]        r off
	 r [keycode]        r on
	 r rate [delay [rate]]
    For screen-saver control:
	 s [timeout [cycle]]  s default    s on
	 s blank              s noblank    s off
	 s expose             s noexpose
	 s activate           s reset
    For status information:  q
    To print version: -version

I haven’t tried any of them though.

If setterm could work, I need help on how to run it. If I just run setterm --blank=2 in a terminal window it complains that the terminal type doesn’t support --blank. That makes sense, since it is talking to the pty. If I add the option --term linux and redirects to the vt < /dev/tty2 > /dev/tty2 there is no complaint, and some escape codes are written according to strace. But it doesn’t seem to have any effect. The --powerdown option is similarly ineffective in graphical mode as far as I can tell.

xset dpms … used to work for this purpose once upon a time, but seems to have gone away with wayland.

mimmi$ xset -q
DPMS (Energy Star):
  Server does not have the DPMS Extension

My assumption is that the Xwayland server doesn’t forward these types of instructions, and some kind of Wayland way to activate screen saving is needed.

I guess that some such Wayland screen saving is what Gnome under GDM, and Plasma under SDDM, is doing. But unfortunately not in compatible ways, apparently. Gnome under SDDM doesn’t work. (I haven’t tried Plasma under GDM recently.)

It looks like under wayland you will have to use the busctl command. From Display is not capable of DPMS After GNOME Wayland update - Unix & Linux Stack Exchange

busctl --user set-property org.gnome.Mutter.DisplayConfig /org/gnome/Mutter/DisplayConfig org.gnome.Mutter.DisplayConfig PowerSaveMode i 1

Other than that, all I can suggest is to verify that all your screensaver settings look right:

gsettings list-recursively | grep -i screensaver

Sorry that I cannot test any of these. My home system is not connected to a traditional monitor. It is connected to a 10+ year old TV by way of a surround sound audio decoder.

Good luck. :slightly_smiling_face:

P.S. Here are the meaning and values for the last number on that busctl command excerpted from Initiatives/Wayland/Gaps/DisplayConfig - GNOME Wiki! :

    Possible values:
    - 0: on
    - 1: standby
    - 2: suspend
    - 3: off

To begin with, I realise I have been bad in saying “thank you” for your attempts to help. I do appreciate your efforts!

gsettings didn’t reveal anything strange, but the pointer to busctl command was a good one! It did succeed in turning off the monitor.

Of course it didn’t activate by just moving the mouse, but after SSH:ing in from another machine and setting the necessary environment vatiables I was also able to turn it on again! :slight_smile:

After digging a bit more near your pointers I found the org.gnome.Mutter.IdleMonitor DBus destination where I can see the inactivity time too. With those tools, I should be able to put together some little bash or python script to act as a simple screen saver meeting my needs.

Again, thanks for your help!