Tell mplayer to prevent the screensaver from kicking in while playing

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite
1












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










share|improve this question

























    up vote
    1
    down vote

    favorite
    1












    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










    share|improve this question























      up vote
      1
      down vote

      favorite
      1









      up vote
      1
      down vote

      favorite
      1






      1





      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










      share|improve this question













      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 screensaver






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 28 '10 at 14:01









      xenoterracide

      25.2k52157221




      25.2k52157221




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          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






          share|improve this answer




















          • 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

















          up vote
          0
          down vote













          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






          share|improve this answer






















          • 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 at 21:21

















          up vote
          0
          down vote













          mplayer -stop-xscreensaver does not work for me (Debian wheezy; xscreensaver=5.15-3, xfce4=4.8.0.3, 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:



          #!/bin/bash
          usage ()
          echo "usage: $0 [on

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

          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
          done
          # echo "$lock is gone"


          lock="/tmp/xsi.lock"

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

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

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

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


          $HOME/bin/play is as follows:



          #!/bin/sh

          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






          share|improve this answer






















            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f1337%2ftell-mplayer-to-prevent-the-screensaver-from-kicking-in-while-playing%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            4
            down vote



            accepted










            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






            share|improve this answer




















            • 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














            up vote
            4
            down vote



            accepted










            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






            share|improve this answer




















            • 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












            up vote
            4
            down vote



            accepted







            up vote
            4
            down vote



            accepted






            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






            share|improve this answer












            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







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 28 '10 at 15:18









            Michael Mrozek

            60k28187208




            60k28187208











            • 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
















            • 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















            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




            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




            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





            @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




            now if only I could do the same thing with flash/<video>
            – xenoterracide
            Aug 29 '10 at 14:12




            1




            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




            @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












            up vote
            0
            down vote













            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






            share|improve this answer






















            • 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 at 21:21














            up vote
            0
            down vote













            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






            share|improve this answer






















            • 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 at 21:21












            up vote
            0
            down vote










            up vote
            0
            down vote









            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






            share|improve this answer














            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







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Feb 24 at 21:54

























            answered Feb 24 at 19:56









            premek.v

            344




            344











            • 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 at 21:21
















            • 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 at 21:21















            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 at 21:21




            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 at 21:21










            up vote
            0
            down vote













            mplayer -stop-xscreensaver does not work for me (Debian wheezy; xscreensaver=5.15-3, xfce4=4.8.0.3, 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:



            #!/bin/bash
            usage ()
            echo "usage: $0 [on

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

            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
            done
            # echo "$lock is gone"


            lock="/tmp/xsi.lock"

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

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

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

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


            $HOME/bin/play is as follows:



            #!/bin/sh

            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






            share|improve this answer


























              up vote
              0
              down vote













              mplayer -stop-xscreensaver does not work for me (Debian wheezy; xscreensaver=5.15-3, xfce4=4.8.0.3, 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:



              #!/bin/bash
              usage ()
              echo "usage: $0 [on

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

              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
              done
              # echo "$lock is gone"


              lock="/tmp/xsi.lock"

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

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

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

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


              $HOME/bin/play is as follows:



              #!/bin/sh

              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






              share|improve this answer
























                up vote
                0
                down vote










                up vote
                0
                down vote









                mplayer -stop-xscreensaver does not work for me (Debian wheezy; xscreensaver=5.15-3, xfce4=4.8.0.3, 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:



                #!/bin/bash
                usage ()
                echo "usage: $0 [on

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

                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
                done
                # echo "$lock is gone"


                lock="/tmp/xsi.lock"

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

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

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

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


                $HOME/bin/play is as follows:



                #!/bin/sh

                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






                share|improve this answer














                mplayer -stop-xscreensaver does not work for me (Debian wheezy; xscreensaver=5.15-3, xfce4=4.8.0.3, 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:



                #!/bin/bash
                usage ()
                echo "usage: $0 [on

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

                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
                done
                # echo "$lock is gone"


                lock="/tmp/xsi.lock"

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

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

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

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


                $HOME/bin/play is as follows:



                #!/bin/sh

                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







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 24 at 19:13

























                answered Jul 23 '14 at 17:38









                retrospectacus

                1011




                1011



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f1337%2ftell-mplayer-to-prevent-the-screensaver-from-kicking-in-while-playing%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown






                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay