Screensaver not starting

My daily driver runs XMonad on NixOS.

My screensaver does not turn on. It seems to get itself in this state within a day or two of rebooting, but it’s difficult to get reliable data on this.

In the past I could issue something like xset s 3 3, which would turn off the screen after 3 seconds, which might then be woken up shortly afterwards by whatever it was that was keeping awake. Now, xset s 3 3 has no observable effect whatsoever.

I have an XMonad keybinding for sleep 1 && xset dpms force off. This still works as a means to turn the screen off. Curiously, if I type the same in a shell, the screen turns off and turns back on again about a second later. However, if I type the same in the dmenu launder, the screen turns off and stays off.

Can you give me any hints about how to track down what is keeping the screen awake?

What screensaver do you use and how did you configure it?

I have no idea.

I’ve been using plain XMonad (that is to say without any fancy display managers, or any other framework) on various OSes since around 2009, and I’m just used to the screen going to sleep after a while. I’m not aware of anything in my configuration that configures it.

This is the only remotely relevant stuff that I can find in /etc/nixos/configuration.nix:

 # Enable the X11 windowing system.
 services.xserver.enable = true;
 services.xserver.layout     = "dvorak, gb, ch";
 services.xserver.xkbVariant = "      ,   , fr";
 # services.xserver.xkbOptions = "eurosign:e";
 services.xserver.windowManager.xmonad.enable = true;
 services.xserver.windowManager.xmonad.enableContribAndExtras = true;
 
 # Enable touchpad support.
 services.xserver.libinput.enable = true;
 
 # Wacom graphics input tablet
 services.xserver.wacom.enable = true;
 
 services.xserver.videoDrivers = [ "modesetting" "nvidia" ];

Can’t find anything relevant in my home-manager home.nix.

Sorry. No idea.

Do you use Chrome (or other Chromium-based browser), by chance? There was a recent Chromium bug that prevented the screensaver from starting.

I was able to track down this bug only because I generally avoid Chrome yet use it on one computer for Reflex FRP development, and only that computer had the issue. The screensaver was blocked depending on what tabs were open. Even starting Chrome without opening any sites was enough to block my screensaver. I never load videos on that computer, so loading videos was not required to block the screensaver in my case.

I had the issue from late May until late August, but it has finally been resolved. I am now running 104.0.5112.101 (Official Build) (64-bit) without issue.

Yes: Brave.

The bug reports seem plausibly consistent with what I’m observing. Though after killing all Brave processes, the screen still doesn’t sleep

Steam is also known to block the screensaver (even when it’s just sitting in the system tray). If that’s your problem, you could try running this overlay (check the comments for necessary tweaks).

Given that and your post I take it you just mean your display blanking then. Screensavers are technically the little programs that do stuff like displaying a lock screen or a pretty animation. The display time out/blank/whatever is a separate thing, controlled by your display driver (can be Xorg, Wayland or the tty, all of which use dpms to do so).

Screen “savers” are so called because they prevent burn-in. Display blanking is a power management feature. They’re often conflated because the screensaver application often also takes it upon itself to configure the screen blank. But if you didn’t install e.g. xscreensaver, your config will be handled by xorg itself (and therefore xset dpms).

Various applications may also disable dpms temporarily, and those may be buggy. After all, it’d be super annoying if the display timed out while you’re watching something.

Let’s confirm your configuration is correct before blaming hypothetical bugs, though. What does xset q give you?

Indeed.

xset q                                                                                                                                                                                                                                                    ─╯
Keyboard Control:
  auto repeat:  on    key click percent:  0    LED mask:  00000000
  XKB indicators:
    00: Caps Lock:   off    01: Num Lock:    off    02: Scroll Lock: off
    03: Compose:     off    04: Kana:        off    05: Sleep:       off
    06: Suspend:     off    07: Mute:        off    08: Misc:        off
    09: Mail:        off    10: Charging:    off    11: Shift Lock:  off
    12: Group 2:     off    13: Mouse Keys:  off
  auto repeat delay:  660    repeat rate:  25
  auto repeating keys:  00ffffffdffffbbf
                        fadfffefffedffff
                        9fffffffffffffff
                        fff7ffffffffffff
  bell percent:  50    bell pitch:  400    bell duration:  100
Pointer Control:
  acceleration:  2/1    threshold:  4
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  0    cycle:  3
Colors:
  default colormap:  0x20    BlackPixel:  0x0    WhitePixel:  0xffffff
Font Path:
  /nix/store/mvk6fchdw9p277i6nzr9kdq8dx54i11m-unifont-14.0.03/share/fonts,/nix/store/8ws90002k1fvh0vxb93gbm5z0cpyxhj9-font-cursor-misc-1.0.3/lib/X11/fonts/misc,/nix/store/d6lxjbp4nkkc38mvq18kski21vgmrg0l-font-misc-misc-1.1.2/lib/X11/fonts/misc,/nix/store/9nipfr5ph8y68cb4axl4ywcv5z6qqsij-font-adobe-100dpi-1.0.3/lib/X11/fonts/100dpi,/nix/store/66fzxwi78dnh7crpspj37yzpc0lfvyc8-font-adobe-75dpi-1.0.3/lib/X11/fonts/75dpi,/nix/store/1iix1bsrkgz19mg5n2xgizdg4d3hdc7b-X11-fonts/share/X11/fonts,built-ins
DPMS (Energy Star):
  Standby: 3    Suspend: 3    Off: 3
  DPMS is Enabled
  Monitor is On