How to turn the screen total/pitch black in GNOME?

Use case / Problem

I wanna hear music in the night with my laptop/device and as such I want the screen to be black, as I don’t want to get dazzled in the night.

Tried workarounds/“solutions”

As such, …:

  • I cannot put it into standby for obvious reasons (music playing stops)
  • I cannot close the lit without going into standby (I know I can adjust this in gnome-tweaks, but really… I don’t wanna disable and re-enable this each time I want to do this, because I usually want to keep the default and very sensible behavior of getting into standby when the lid is closed)
  • I could try any physical solutions to the problem, like closing the lid partially, wearing sunclasses or eye masks or placing the device facing me away or even putting some light-blocking object between me and the device.
    However, this would cause other downsides like needing to reverse the workaround when you want to pause the music or skip a track or so (access to keyboard could be limited in these scenarios).
    Also, it’s really inconvenient. (but closing the lid is e.g. sth. I instinctively do as a workaround, and it’s not perfect due to the light reflection.)
  • One solution that partially works, even though it may not be obvious at first, is: Lock your screen!
    This does not only prevent from cat pictures (or similar) appearing on your screen, but also actually fade the window to black in recent GNOME versions.
    The problems with this solution/approach are:
    • Any keypress will wake the screen up, even if it is just the keyboard button for pausing music or skipping a track.
    • Worse, any notification will wake your screen up. (Again I could circumvent this by enabling “Do not disturb” mode, but really, do I want to do that just for that? Again very inconvenient.)
    • Also, there may the inevitable “This system will go to standby soon” notification (at least in GNOME 41), which will wake-up your screen,
    • Now, worst though, after your screen woke up once and you are now at the login/lock screen, if you wait the screen will not turn black again automatically. The only workaround I found for this is logging in and, yet again, re-locking it. Do I need to say another time this usability s………eems to be not the best?

An “old” solution I had was one:

  • Another laptop I used had a special Fn button, which would just turn the whole screen black. It looked as if it was not a hardware thing, but somehow GNOME really interpreted that key correctly.

Now, I desperately miss that key or that feature in general.

Solution wanted

I want to have a keyboard shortcut/hotkey or something equally easily accessible that just turns the screen black. Pitch black, so I am not dazzled.
It, thought, must not turn the device into standby. (Music players usually have a lock on that, so GNOME won’t do that by default anyway, but one could always trigger standby manually of course.)

How can I do that?

System

GNOME 42.1
Fedora 36 (Silverblue)


Cross-posed to Unix & Linux Stackexchange. Feel free to submit your answer there, too, if you have one.

Hi,

A google search found this:

Just tested this:

busctl --user call org.gnome.Shell /org/gnome/ScreenSaver org.gnome.ScreenSaver SetActive b true

I put this ~/bin/blank.sh

Then setup a keyboard shortcut super+b, command: blank.sh.

Thanks Tom.

2 Likes