GNOME is one of the worst offenders, and ignores even the now widely supported idle-inhibit protocol. (This is either due to a combination of malice and incompetence, but since implementing this protocol would only take a few lines of code, it is most likely the former. You will also notice how GNOME advocates react offended whenever their sabotage is pointed out, which indicates either hypocrisy, or even worse ignorance.) Such incompatible desktop environments (i.e. which ignore standards) typically require using a DBus API. This is ridiculous in several ways. The immediate practical problem is that it would require adding a quite unwieldy dependency for a DBus library, somehow integrating its main‐ loop into mpv, and other generally unacceptable things.Unfortunately, non GNOME DEs like e.g. Xfce are also affected. Fortunately, another hack exists - the Lua script. Put the following Lua script under your ~/.config/mpv/scripts directory and name it e.g. stop-screensaver.lua:
local timeout_sec = 60 function timeout_fn() mp.commandv("run", "/usr/bin/bash", "-c", "/usr/bin/xdg-screensaver reset &>/dev/null") end mp.add_periodic_timer(timeout_sec, timeout_fn)This script will periodically calls the 'xdg-screensaver reset', similarly as the original mpv hack did. You may need customize the timeout - I used 60 seconds, because my screensaver timout is much higher - and maybe the paths to the bash and xdg-screensaver. This script was tested on Fedora 33.