When you are watching a movie, many a times, the xscreensaver kicks in after sometime. Is there a way to tell xscreensaver not to kick in when watching a movie ?

Somebody told me and I tried this -

[$] alias mpv                                                                                                                       
mpv=$'mate-session-inhibit --inhibit\n/usr/bin/mpv'

This used to work but now doesn't. have no ideas why. Can somebody explain the above command as well.

This is xscreensaver is stacked up -

 5  timeout:    0:05:00
 6  cycle:      0:02:00
 7  lock:       True
 8  lockTimeout:    0:05:00
 9  passwdTimeout:  0:00:30

So, if I'm reading it right, it seems it says the actual timeout is around 10 mins, see Xscreen saver not locking user for xscreensaver reading.

Update - I am running/using mpv 0.23 on Debian testing/stretch.


Add heartbeat-cmd="/usr/bin/xscreensaver-command -deactivate > /dev/null" in .config/mpv/config at the bottom.

But this option will get Deprecated in newer Version mpv github

  • I Updated my query with giving the version at my end. The heartbeat-cmd seems to have been deprecated at 0.18 itself so 0.23 is long ways off, sorry. – shirish Mar 11 '17 at 10:33
  • check with ` mpv --list-options` if something digestible is for you. I use mpv 0.8.3 so it still working. :D – user192526 Mar 11 '17 at 10:51
  • yup, tried it and still it works, it does give the warning though. – shirish Mar 12 '17 at 17:56
  • Disabled in deb10/buster. Option --heartbeat-cmd was removed: use Lua scripting instead – Andrew Domaszek Jun 11 '19 at 13:58


If it is a bug, as you mention in a comment, you might use a small workaround to fix it.

If you run the small script below in the background (start it a few seconds after log in), it will prevent the screensaver to be triggered if and while mpv is running.

The script

while true
sleep 60
if [ -n "$(pgrep mpv)" ]; then
 xdotool key Ctrl

How to use

  1. The script needs xdotool to be on your system.
  2. Then, simply copy the script into an empty file, start it on log in.

What it does

Practically nothing. Only once per minute, it checks if mpv is running, taps the Ctrl key if so, to make sure idle time is set to zero.


As mentioned in a comment, the script can be used without any changes in zsh, however if you run it as an executable script (calling the interpreter from the shebang), change the shebang into #!/bin/zsh.

  • Would the script be much different in zsh ? And btw debian has xdotool, see tracker.debian.org/pkg/xdotool – shirish Mar 11 '17 at 12:58
  • @shirish a quick test seems to show the script can be run without any changes but the shebang, if it is executable. Simply replace the shebang with: #!/bin/zsh – Jacob Vlijm Mar 11 '17 at 13:04
  • @shirish just curious, but did you try? – Jacob Vlijm Mar 12 '17 at 10:31
  • not really, because my issue was solved with Bahamut's solution for now. I try to avoid scripts as the script depends on things remaining the same. If any of the packages do a change, it is highly likely the script may stop working. I still upped you as you made me aware of the tool xdotool which I wasn't aware of before. – shirish Mar 12 '17 at 17:58
  • @shirish thanks! I will be highly surprised if either xdotool or bash/zsh would end working as it does for the next 10 or 15 years though. That's all that is functional in the scrip. – Jacob Vlijm Mar 12 '17 at 18:03

Why not switch it off? This is 2017 and you shouldn't need a screensaver!

Use the Mode drop-down and change it to "Disable Screen Saver."

  • what do you mean by use the mode drop-down and change it to "Disable Screen Saver." Can you elaborate what you mean by it. – shirish Mar 10 '17 at 22:01
  • Is it in your Menu? Preferences>Screensaver – user8779 Mar 10 '17 at 22:06
  • There are actually two, mate-screensaver is off. I also have traditional xscreensaver package whose values I just shared with you up. – shirish Mar 10 '17 at 22:08
  • 1
    In aa Terminal input: xscreenserver-command -exit – user8779 Mar 10 '17 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.