I know mplayer has some heartbeat setting but I don't recall what it is, could anyone tell me?

another one of those annoying things that used to just work and somewhere along the line stopped being default


mplayer has the switch -heartbeat-cmd to run a command every 30 seconds, but as the man page says:

This can be "misused" to disable screensavers that do not support the proper X API

The actual switch meant to disable screensavers is -stop-xscreensaver; you should probably try that first

  • I put -stop-xscreensaver in ~/.mplayer/config when trying to play a video I got this error: Option -stop-xscreensaver needs a parameter at line 2 ideas? – xenoterracide Aug 28 '10 at 15:47
  • 3
    @xeno Every option in the config file needs to have a value; if it's just a boolean flag, set it equal to true, yes, or 1. You also shouldn't include the - when you're using the config file, so you'll get a warning about an unknown option (it sees your entry for -stop-xscreensaver and looks for the flag --stop-xscreensaver); it should read stop-xscreensaver=true instead – Michael Mrozek Aug 28 '10 at 18:03
  • now if only I could do the same thing with flash/<video> – xenoterracide Aug 29 '10 at 14:12
  • 1
    @xenoterracide you can use mplayer to watch flash videos, load the video, look in /tmp and play the video with mplayer :P – hiena Aug 30 '10 at 12:56

mplayer -stop-xscreensaver does not work for me (Debian wheezy; xscreensaver=5.15-3, xfce4=, mplayer=2:1.0~rc4.dfsg1+svn34540-1+b2) - the screensaver still comes on during the movie. I wrote a screensaver inhibition tool xscreensaver-inhibit, and an mplayer wrapper play. xscreensaver-inhibit is useful for other things like youtube so I put a shortcut on my panel for it.

$HOME/bin/xscreensaver-inhibit is as follows:

usage () {
    echo "usage: $0 [on|off]"
    echo '    Turns screensaver inhibition on or off.'
    echo '    default: toggle on/off'
    exit 1;

if [ -n "$1" ]  ; then
    [ "$1" = "on" -o "$1" = "off" ] || usage

inhibit () {
    while [ -f "$lock" ] ; do
        # echo "$lock exists"
# UPDATE Dec 2018 this command seems to have stopped working after upgrading to Debian Stretch.
        # DISPLAY=:0 xdg-screensaver reset
# Replaced with this command which is working for me,
# though if you do not use xscreensaver you might need something else.
        DISPLAY=:0 xscreensaver-command -deactivate
        sleep 50
    # echo "$lock is gone"


if [ -e "$lock" ] ; then
    echo 'Screensaver currently inhibited.'
    echo 'Screensaver operating normally.'

if [ "$1" = "on" ] ; then
    if [ -n "$on" ] ; then
        echo 'Starting screensaver inhibitor anyway.'
        echo 'Screensaver inhibitor started.'
    touch "$lock" && inhibit &

if [ "$1" = "off" ] ; then
    if [ -n "$on" ] ; then
        echo 'Screensaver inhibitor(s) stopped.'
        echo 'Perhaps the screensaver daemon is not running or another program is inhibiting it.'
    rm -f "$lock"

if [ ! -n "$1" ] ; then
    if [ -n "$on" ] ; then
        echo 'Screensaver inhibitor(s) stopped.'
        rm -f "$lock"
        echo 'Screensaver inhibitor started.'
        touch "$lock" && inhibit &

$HOME/bin/play is as follows:


xscreensaver-inhibit on

DISPLAY=:0 mplayer -fs "$@"

xscreensaver-inhibit off

I included DISPLAY=:0 so the movie will play on the local active display even when I am logged in over SSH. play is also the default handler for all movie files in my file manager.

Note that sox provides /usr/bin/play so if you have sox installed, you might want to call play something else.

You can write similar wrappers for your other fullscreen apps that you don't want the screensaver interrupting.

xscreensaver-inhibit works on all DEs, Linuxes, and screensavers on which I have tried it. In case you get xdg-screensaver: command not found, run apt-get install xdg-utils.

UPDATE Dec 2018 changed main command in xscreensaver-inhibit from xdg-screensaver to xscreensaver-command - NOT tested on all DEs, Linuxes, screensavers. YMMV


For me it's --stop-screensaver

When using --stop-xscreensaver the mplayer warns me: option --stop-xscreensaver was replaced with --stop-screensaver and might be removed in the future.

Debian & mpv 0.23.0 (C) 2000-2016 mpv/MPlayer/mplayer2 projects

  • Are you quoting from somewhere?   If so, please identify the source.   Please do not respond in comments; edit your answer to make it clearer and more complete. – Scott Feb 24 '18 at 21:21

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.