When I watch a video online the screen turns off after a few minutes












5















in some sites when I watch a movie in a browser and I don't touch the computer the screen turns off. In other sites like Youtube I don't have that problem.
I tried using caffeine but I don't like the idea of having to manually enable and disable it every time I watch a video. I also tried other methods that I found on the internet but nothing worked.
any suggestions?
I'm using chrome and running ubuntu 16.04.










share|improve this question


















  • 1





    Could you give an example of a video that makes you(r screen) fall asleep? need to look into the processes. See if we can get anything usefull out of it.

    – Jacob Vlijm
    May 28 '16 at 20:55













  • More specifically can you provide a link to one or more videos that will not inhibit the screensaver (that's the proper lingo for "preventing the screen from falling asleep)? I suspect they're Flash videos. Can you confirm or deny that?

    – David Foerster
    May 28 '16 at 22:35











  • FWIW, I find it happens in Totem as well as with Flash videos. askubuntu.com/questions/778882/…

    – Amanda
    May 29 '16 at 4:58











  • I would suggest "caffeine". It keeps your computer awake ubuntuhandbook.org/index.php/2015/01/…

    – nicandris
    May 29 '16 at 8:57
















5















in some sites when I watch a movie in a browser and I don't touch the computer the screen turns off. In other sites like Youtube I don't have that problem.
I tried using caffeine but I don't like the idea of having to manually enable and disable it every time I watch a video. I also tried other methods that I found on the internet but nothing worked.
any suggestions?
I'm using chrome and running ubuntu 16.04.










share|improve this question


















  • 1





    Could you give an example of a video that makes you(r screen) fall asleep? need to look into the processes. See if we can get anything usefull out of it.

    – Jacob Vlijm
    May 28 '16 at 20:55













  • More specifically can you provide a link to one or more videos that will not inhibit the screensaver (that's the proper lingo for "preventing the screen from falling asleep)? I suspect they're Flash videos. Can you confirm or deny that?

    – David Foerster
    May 28 '16 at 22:35











  • FWIW, I find it happens in Totem as well as with Flash videos. askubuntu.com/questions/778882/…

    – Amanda
    May 29 '16 at 4:58











  • I would suggest "caffeine". It keeps your computer awake ubuntuhandbook.org/index.php/2015/01/…

    – nicandris
    May 29 '16 at 8:57














5












5








5


2






in some sites when I watch a movie in a browser and I don't touch the computer the screen turns off. In other sites like Youtube I don't have that problem.
I tried using caffeine but I don't like the idea of having to manually enable and disable it every time I watch a video. I also tried other methods that I found on the internet but nothing worked.
any suggestions?
I'm using chrome and running ubuntu 16.04.










share|improve this question














in some sites when I watch a movie in a browser and I don't touch the computer the screen turns off. In other sites like Youtube I don't have that problem.
I tried using caffeine but I don't like the idea of having to manually enable and disable it every time I watch a video. I also tried other methods that I found on the internet but nothing worked.
any suggestions?
I'm using chrome and running ubuntu 16.04.







video google-chrome lock-screen






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 28 '16 at 13:28









p3pc1styl3p3pc1styl3

336




336








  • 1





    Could you give an example of a video that makes you(r screen) fall asleep? need to look into the processes. See if we can get anything usefull out of it.

    – Jacob Vlijm
    May 28 '16 at 20:55













  • More specifically can you provide a link to one or more videos that will not inhibit the screensaver (that's the proper lingo for "preventing the screen from falling asleep)? I suspect they're Flash videos. Can you confirm or deny that?

    – David Foerster
    May 28 '16 at 22:35











  • FWIW, I find it happens in Totem as well as with Flash videos. askubuntu.com/questions/778882/…

    – Amanda
    May 29 '16 at 4:58











  • I would suggest "caffeine". It keeps your computer awake ubuntuhandbook.org/index.php/2015/01/…

    – nicandris
    May 29 '16 at 8:57














  • 1





    Could you give an example of a video that makes you(r screen) fall asleep? need to look into the processes. See if we can get anything usefull out of it.

    – Jacob Vlijm
    May 28 '16 at 20:55













  • More specifically can you provide a link to one or more videos that will not inhibit the screensaver (that's the proper lingo for "preventing the screen from falling asleep)? I suspect they're Flash videos. Can you confirm or deny that?

    – David Foerster
    May 28 '16 at 22:35











  • FWIW, I find it happens in Totem as well as with Flash videos. askubuntu.com/questions/778882/…

    – Amanda
    May 29 '16 at 4:58











  • I would suggest "caffeine". It keeps your computer awake ubuntuhandbook.org/index.php/2015/01/…

    – nicandris
    May 29 '16 at 8:57








1




1





Could you give an example of a video that makes you(r screen) fall asleep? need to look into the processes. See if we can get anything usefull out of it.

– Jacob Vlijm
May 28 '16 at 20:55







Could you give an example of a video that makes you(r screen) fall asleep? need to look into the processes. See if we can get anything usefull out of it.

– Jacob Vlijm
May 28 '16 at 20:55















More specifically can you provide a link to one or more videos that will not inhibit the screensaver (that's the proper lingo for "preventing the screen from falling asleep)? I suspect they're Flash videos. Can you confirm or deny that?

– David Foerster
May 28 '16 at 22:35





More specifically can you provide a link to one or more videos that will not inhibit the screensaver (that's the proper lingo for "preventing the screen from falling asleep)? I suspect they're Flash videos. Can you confirm or deny that?

– David Foerster
May 28 '16 at 22:35













FWIW, I find it happens in Totem as well as with Flash videos. askubuntu.com/questions/778882/…

– Amanda
May 29 '16 at 4:58





FWIW, I find it happens in Totem as well as with Flash videos. askubuntu.com/questions/778882/…

– Amanda
May 29 '16 at 4:58













I would suggest "caffeine". It keeps your computer awake ubuntuhandbook.org/index.php/2015/01/…

– nicandris
May 29 '16 at 8:57





I would suggest "caffeine". It keeps your computer awake ubuntuhandbook.org/index.php/2015/01/…

– nicandris
May 29 '16 at 8:57










2 Answers
2






active

oldest

votes


















6














UPDATE 2017/08/23: Changed script to one that doesn't send keystrokes but disables dpms and the screensaver temporarily while a video is playing full screen.



This only works with applications running full screen, not maximized.





First install xdotool:



sudo apt install xdotool


then I created a scripts folder in my home folder that I could drop any scripts into that I wanted to keep:



mkdir -p ~/scripts


then I created a file called check_full.bsh in my ~/scripts folder and added the following content to it:



Since my screensaver is set for 20 minutes, I set the sleep timer in the script to 10 minutes (600 seconds). You can change this based on your screensaver settings.



#!/bin/bash

#Get DPMS settings
dpms_set=$(xset -q | grep -i "dpms is" | awk '{print $NF}')

#Get screensaver type and command
scrnsvr=$(ps -ef | grep screensav | grep -v grep | awk '{print $8}')
scrnsvrcmd=$(ps -ef | grep screensav | grep -v grep | awk '{print substr($0,index($0,$8))}')

#Sleep Timer in seconds.
SL=600

while true;
do
result=()
#Get all window geometries
all=($(xdotool search --name - | while read win; do xdotool getwindowgeometry $win | grep Geometry | awk '{print $2}'; done))

#Get all screen resolutions detected and build array.
SCREENS=($(xrandr | grep * | awk '{print $1}'))

SCRN=" ${SCREENS[*]} "

#Get result of all windows and match

for item in ${all[@]}; do if [[ $SCRN =~ " $item " ]] ; then result+=($item); fi; done

#If a result exists disable power management and screensaver
if [[ ${result[@]} ]]; then
ps -ef | grep $scrnsvr | grep -v grep >/dev/null
if [[ $? == 0 ]]; then
kill $(ps -ef | grep $scrnsvr | grep -v grep | awk '{print $2}')
fi
if [[ $dpms_set == "Enabled" ]];then
xset -dpms
fi
else
ps -ef | grep $scrnsvr | grep -v grep >/dev/null
if [[ $? == 1 ]]; then
${scrnsvrcmd} &
fi
if [[ $dpms_set != "Disabled" ]];then
xset dpms
fi
fi
result=()
sleep $SL
done


make the script executable:



chmod +x ~/scripts/check_full.bsh


For some reason, a cron job would not run this correctly. So I added an entry to my startup to call this script. In the ~/.config/autostart/ folder, I created a file called Check_Full.desktop with the following content:



I like to have delays added to startup as they usually load better.



[Desktop Entry]
Type=Application
Name=Check_Full
Comment=Prevent screensaver from activating when full screen video is playing
Exec=bash -c 'sleep 5 && /home/<username>/scripts/check_full.bsh'


change above Exec line to match your home folder.



Set proper permissions to the file:



chmod 664 ~/.config/autostart/Check_full.desktop


After logging out and back in, check_full.bsh is now running and checking every 10 minutes if active application is full screen. If not, screensaver / lock screen launch at normal times.





Hope this helps!






share|improve this answer


























  • thank you so much! It worked. Couldn't fix it without you

    – p3pc1styl3
    May 30 '16 at 15:35








  • 2





    @p3pc1styl3 You're very welcome! Please check the check mark next to my answer showing that it helped you and it can help others looking for the same thing. I came up with this because although there are good solutions out there, none of them allowed me to run whatever player I wanted to to watch videos, so I came up with this script to detect anything in full screen mode. Figured that just made it easier. Glad it is helping you! =)

    – Terrance
    May 30 '16 at 16:05











  • Please don't make a ton of edits to your answer over time, Terrance. Only make updates when there's something major to change, a ton of minor edits usually is not a good thing.

    – Thomas Ward
    Aug 23 '17 at 18:13











  • @ThomasWard I understand. I didn't like the old answer I had and I dumped that one. I didn't think there were a ton of minor edits anyway.

    – Terrance
    Aug 23 '17 at 18:14











  • @Terrance Might want to look at the revision history of your answer here then and see how many small revisions you've made over time.

    – Thomas Ward
    Aug 23 '17 at 18:15



















5














Youtube doesn't have that problem because it uses HTML5 player. The sites you're having the problem with are using Flash Player instead. It is a bug in Adobe Flashplayer, which, in short, is that it never notifies WM that it ran into fullscreen. You may have heard though that Adobe Flash is a buggy app in general, so one workaround is to disable it, and use only sites with HTML5 video.



As you mentioned caffeine, you probably have searched for a solution already. Another thing you could do is to disable «power saving» completely, i.e. to force the screen to never turn off.






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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%2faskubuntu.com%2fquestions%2f778688%2fwhen-i-watch-a-video-online-the-screen-turns-off-after-a-few-minutes%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    6














    UPDATE 2017/08/23: Changed script to one that doesn't send keystrokes but disables dpms and the screensaver temporarily while a video is playing full screen.



    This only works with applications running full screen, not maximized.





    First install xdotool:



    sudo apt install xdotool


    then I created a scripts folder in my home folder that I could drop any scripts into that I wanted to keep:



    mkdir -p ~/scripts


    then I created a file called check_full.bsh in my ~/scripts folder and added the following content to it:



    Since my screensaver is set for 20 minutes, I set the sleep timer in the script to 10 minutes (600 seconds). You can change this based on your screensaver settings.



    #!/bin/bash

    #Get DPMS settings
    dpms_set=$(xset -q | grep -i "dpms is" | awk '{print $NF}')

    #Get screensaver type and command
    scrnsvr=$(ps -ef | grep screensav | grep -v grep | awk '{print $8}')
    scrnsvrcmd=$(ps -ef | grep screensav | grep -v grep | awk '{print substr($0,index($0,$8))}')

    #Sleep Timer in seconds.
    SL=600

    while true;
    do
    result=()
    #Get all window geometries
    all=($(xdotool search --name - | while read win; do xdotool getwindowgeometry $win | grep Geometry | awk '{print $2}'; done))

    #Get all screen resolutions detected and build array.
    SCREENS=($(xrandr | grep * | awk '{print $1}'))

    SCRN=" ${SCREENS[*]} "

    #Get result of all windows and match

    for item in ${all[@]}; do if [[ $SCRN =~ " $item " ]] ; then result+=($item); fi; done

    #If a result exists disable power management and screensaver
    if [[ ${result[@]} ]]; then
    ps -ef | grep $scrnsvr | grep -v grep >/dev/null
    if [[ $? == 0 ]]; then
    kill $(ps -ef | grep $scrnsvr | grep -v grep | awk '{print $2}')
    fi
    if [[ $dpms_set == "Enabled" ]];then
    xset -dpms
    fi
    else
    ps -ef | grep $scrnsvr | grep -v grep >/dev/null
    if [[ $? == 1 ]]; then
    ${scrnsvrcmd} &
    fi
    if [[ $dpms_set != "Disabled" ]];then
    xset dpms
    fi
    fi
    result=()
    sleep $SL
    done


    make the script executable:



    chmod +x ~/scripts/check_full.bsh


    For some reason, a cron job would not run this correctly. So I added an entry to my startup to call this script. In the ~/.config/autostart/ folder, I created a file called Check_Full.desktop with the following content:



    I like to have delays added to startup as they usually load better.



    [Desktop Entry]
    Type=Application
    Name=Check_Full
    Comment=Prevent screensaver from activating when full screen video is playing
    Exec=bash -c 'sleep 5 && /home/<username>/scripts/check_full.bsh'


    change above Exec line to match your home folder.



    Set proper permissions to the file:



    chmod 664 ~/.config/autostart/Check_full.desktop


    After logging out and back in, check_full.bsh is now running and checking every 10 minutes if active application is full screen. If not, screensaver / lock screen launch at normal times.





    Hope this helps!






    share|improve this answer


























    • thank you so much! It worked. Couldn't fix it without you

      – p3pc1styl3
      May 30 '16 at 15:35








    • 2





      @p3pc1styl3 You're very welcome! Please check the check mark next to my answer showing that it helped you and it can help others looking for the same thing. I came up with this because although there are good solutions out there, none of them allowed me to run whatever player I wanted to to watch videos, so I came up with this script to detect anything in full screen mode. Figured that just made it easier. Glad it is helping you! =)

      – Terrance
      May 30 '16 at 16:05











    • Please don't make a ton of edits to your answer over time, Terrance. Only make updates when there's something major to change, a ton of minor edits usually is not a good thing.

      – Thomas Ward
      Aug 23 '17 at 18:13











    • @ThomasWard I understand. I didn't like the old answer I had and I dumped that one. I didn't think there were a ton of minor edits anyway.

      – Terrance
      Aug 23 '17 at 18:14











    • @Terrance Might want to look at the revision history of your answer here then and see how many small revisions you've made over time.

      – Thomas Ward
      Aug 23 '17 at 18:15
















    6














    UPDATE 2017/08/23: Changed script to one that doesn't send keystrokes but disables dpms and the screensaver temporarily while a video is playing full screen.



    This only works with applications running full screen, not maximized.





    First install xdotool:



    sudo apt install xdotool


    then I created a scripts folder in my home folder that I could drop any scripts into that I wanted to keep:



    mkdir -p ~/scripts


    then I created a file called check_full.bsh in my ~/scripts folder and added the following content to it:



    Since my screensaver is set for 20 minutes, I set the sleep timer in the script to 10 minutes (600 seconds). You can change this based on your screensaver settings.



    #!/bin/bash

    #Get DPMS settings
    dpms_set=$(xset -q | grep -i "dpms is" | awk '{print $NF}')

    #Get screensaver type and command
    scrnsvr=$(ps -ef | grep screensav | grep -v grep | awk '{print $8}')
    scrnsvrcmd=$(ps -ef | grep screensav | grep -v grep | awk '{print substr($0,index($0,$8))}')

    #Sleep Timer in seconds.
    SL=600

    while true;
    do
    result=()
    #Get all window geometries
    all=($(xdotool search --name - | while read win; do xdotool getwindowgeometry $win | grep Geometry | awk '{print $2}'; done))

    #Get all screen resolutions detected and build array.
    SCREENS=($(xrandr | grep * | awk '{print $1}'))

    SCRN=" ${SCREENS[*]} "

    #Get result of all windows and match

    for item in ${all[@]}; do if [[ $SCRN =~ " $item " ]] ; then result+=($item); fi; done

    #If a result exists disable power management and screensaver
    if [[ ${result[@]} ]]; then
    ps -ef | grep $scrnsvr | grep -v grep >/dev/null
    if [[ $? == 0 ]]; then
    kill $(ps -ef | grep $scrnsvr | grep -v grep | awk '{print $2}')
    fi
    if [[ $dpms_set == "Enabled" ]];then
    xset -dpms
    fi
    else
    ps -ef | grep $scrnsvr | grep -v grep >/dev/null
    if [[ $? == 1 ]]; then
    ${scrnsvrcmd} &
    fi
    if [[ $dpms_set != "Disabled" ]];then
    xset dpms
    fi
    fi
    result=()
    sleep $SL
    done


    make the script executable:



    chmod +x ~/scripts/check_full.bsh


    For some reason, a cron job would not run this correctly. So I added an entry to my startup to call this script. In the ~/.config/autostart/ folder, I created a file called Check_Full.desktop with the following content:



    I like to have delays added to startup as they usually load better.



    [Desktop Entry]
    Type=Application
    Name=Check_Full
    Comment=Prevent screensaver from activating when full screen video is playing
    Exec=bash -c 'sleep 5 && /home/<username>/scripts/check_full.bsh'


    change above Exec line to match your home folder.



    Set proper permissions to the file:



    chmod 664 ~/.config/autostart/Check_full.desktop


    After logging out and back in, check_full.bsh is now running and checking every 10 minutes if active application is full screen. If not, screensaver / lock screen launch at normal times.





    Hope this helps!






    share|improve this answer


























    • thank you so much! It worked. Couldn't fix it without you

      – p3pc1styl3
      May 30 '16 at 15:35








    • 2





      @p3pc1styl3 You're very welcome! Please check the check mark next to my answer showing that it helped you and it can help others looking for the same thing. I came up with this because although there are good solutions out there, none of them allowed me to run whatever player I wanted to to watch videos, so I came up with this script to detect anything in full screen mode. Figured that just made it easier. Glad it is helping you! =)

      – Terrance
      May 30 '16 at 16:05











    • Please don't make a ton of edits to your answer over time, Terrance. Only make updates when there's something major to change, a ton of minor edits usually is not a good thing.

      – Thomas Ward
      Aug 23 '17 at 18:13











    • @ThomasWard I understand. I didn't like the old answer I had and I dumped that one. I didn't think there were a ton of minor edits anyway.

      – Terrance
      Aug 23 '17 at 18:14











    • @Terrance Might want to look at the revision history of your answer here then and see how many small revisions you've made over time.

      – Thomas Ward
      Aug 23 '17 at 18:15














    6












    6








    6







    UPDATE 2017/08/23: Changed script to one that doesn't send keystrokes but disables dpms and the screensaver temporarily while a video is playing full screen.



    This only works with applications running full screen, not maximized.





    First install xdotool:



    sudo apt install xdotool


    then I created a scripts folder in my home folder that I could drop any scripts into that I wanted to keep:



    mkdir -p ~/scripts


    then I created a file called check_full.bsh in my ~/scripts folder and added the following content to it:



    Since my screensaver is set for 20 minutes, I set the sleep timer in the script to 10 minutes (600 seconds). You can change this based on your screensaver settings.



    #!/bin/bash

    #Get DPMS settings
    dpms_set=$(xset -q | grep -i "dpms is" | awk '{print $NF}')

    #Get screensaver type and command
    scrnsvr=$(ps -ef | grep screensav | grep -v grep | awk '{print $8}')
    scrnsvrcmd=$(ps -ef | grep screensav | grep -v grep | awk '{print substr($0,index($0,$8))}')

    #Sleep Timer in seconds.
    SL=600

    while true;
    do
    result=()
    #Get all window geometries
    all=($(xdotool search --name - | while read win; do xdotool getwindowgeometry $win | grep Geometry | awk '{print $2}'; done))

    #Get all screen resolutions detected and build array.
    SCREENS=($(xrandr | grep * | awk '{print $1}'))

    SCRN=" ${SCREENS[*]} "

    #Get result of all windows and match

    for item in ${all[@]}; do if [[ $SCRN =~ " $item " ]] ; then result+=($item); fi; done

    #If a result exists disable power management and screensaver
    if [[ ${result[@]} ]]; then
    ps -ef | grep $scrnsvr | grep -v grep >/dev/null
    if [[ $? == 0 ]]; then
    kill $(ps -ef | grep $scrnsvr | grep -v grep | awk '{print $2}')
    fi
    if [[ $dpms_set == "Enabled" ]];then
    xset -dpms
    fi
    else
    ps -ef | grep $scrnsvr | grep -v grep >/dev/null
    if [[ $? == 1 ]]; then
    ${scrnsvrcmd} &
    fi
    if [[ $dpms_set != "Disabled" ]];then
    xset dpms
    fi
    fi
    result=()
    sleep $SL
    done


    make the script executable:



    chmod +x ~/scripts/check_full.bsh


    For some reason, a cron job would not run this correctly. So I added an entry to my startup to call this script. In the ~/.config/autostart/ folder, I created a file called Check_Full.desktop with the following content:



    I like to have delays added to startup as they usually load better.



    [Desktop Entry]
    Type=Application
    Name=Check_Full
    Comment=Prevent screensaver from activating when full screen video is playing
    Exec=bash -c 'sleep 5 && /home/<username>/scripts/check_full.bsh'


    change above Exec line to match your home folder.



    Set proper permissions to the file:



    chmod 664 ~/.config/autostart/Check_full.desktop


    After logging out and back in, check_full.bsh is now running and checking every 10 minutes if active application is full screen. If not, screensaver / lock screen launch at normal times.





    Hope this helps!






    share|improve this answer















    UPDATE 2017/08/23: Changed script to one that doesn't send keystrokes but disables dpms and the screensaver temporarily while a video is playing full screen.



    This only works with applications running full screen, not maximized.





    First install xdotool:



    sudo apt install xdotool


    then I created a scripts folder in my home folder that I could drop any scripts into that I wanted to keep:



    mkdir -p ~/scripts


    then I created a file called check_full.bsh in my ~/scripts folder and added the following content to it:



    Since my screensaver is set for 20 minutes, I set the sleep timer in the script to 10 minutes (600 seconds). You can change this based on your screensaver settings.



    #!/bin/bash

    #Get DPMS settings
    dpms_set=$(xset -q | grep -i "dpms is" | awk '{print $NF}')

    #Get screensaver type and command
    scrnsvr=$(ps -ef | grep screensav | grep -v grep | awk '{print $8}')
    scrnsvrcmd=$(ps -ef | grep screensav | grep -v grep | awk '{print substr($0,index($0,$8))}')

    #Sleep Timer in seconds.
    SL=600

    while true;
    do
    result=()
    #Get all window geometries
    all=($(xdotool search --name - | while read win; do xdotool getwindowgeometry $win | grep Geometry | awk '{print $2}'; done))

    #Get all screen resolutions detected and build array.
    SCREENS=($(xrandr | grep * | awk '{print $1}'))

    SCRN=" ${SCREENS[*]} "

    #Get result of all windows and match

    for item in ${all[@]}; do if [[ $SCRN =~ " $item " ]] ; then result+=($item); fi; done

    #If a result exists disable power management and screensaver
    if [[ ${result[@]} ]]; then
    ps -ef | grep $scrnsvr | grep -v grep >/dev/null
    if [[ $? == 0 ]]; then
    kill $(ps -ef | grep $scrnsvr | grep -v grep | awk '{print $2}')
    fi
    if [[ $dpms_set == "Enabled" ]];then
    xset -dpms
    fi
    else
    ps -ef | grep $scrnsvr | grep -v grep >/dev/null
    if [[ $? == 1 ]]; then
    ${scrnsvrcmd} &
    fi
    if [[ $dpms_set != "Disabled" ]];then
    xset dpms
    fi
    fi
    result=()
    sleep $SL
    done


    make the script executable:



    chmod +x ~/scripts/check_full.bsh


    For some reason, a cron job would not run this correctly. So I added an entry to my startup to call this script. In the ~/.config/autostart/ folder, I created a file called Check_Full.desktop with the following content:



    I like to have delays added to startup as they usually load better.



    [Desktop Entry]
    Type=Application
    Name=Check_Full
    Comment=Prevent screensaver from activating when full screen video is playing
    Exec=bash -c 'sleep 5 && /home/<username>/scripts/check_full.bsh'


    change above Exec line to match your home folder.



    Set proper permissions to the file:



    chmod 664 ~/.config/autostart/Check_full.desktop


    After logging out and back in, check_full.bsh is now running and checking every 10 minutes if active application is full screen. If not, screensaver / lock screen launch at normal times.





    Hope this helps!







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Feb 2 at 23:19

























    answered May 28 '16 at 20:34









    TerranceTerrance

    20.1k34898




    20.1k34898













    • thank you so much! It worked. Couldn't fix it without you

      – p3pc1styl3
      May 30 '16 at 15:35








    • 2





      @p3pc1styl3 You're very welcome! Please check the check mark next to my answer showing that it helped you and it can help others looking for the same thing. I came up with this because although there are good solutions out there, none of them allowed me to run whatever player I wanted to to watch videos, so I came up with this script to detect anything in full screen mode. Figured that just made it easier. Glad it is helping you! =)

      – Terrance
      May 30 '16 at 16:05











    • Please don't make a ton of edits to your answer over time, Terrance. Only make updates when there's something major to change, a ton of minor edits usually is not a good thing.

      – Thomas Ward
      Aug 23 '17 at 18:13











    • @ThomasWard I understand. I didn't like the old answer I had and I dumped that one. I didn't think there were a ton of minor edits anyway.

      – Terrance
      Aug 23 '17 at 18:14











    • @Terrance Might want to look at the revision history of your answer here then and see how many small revisions you've made over time.

      – Thomas Ward
      Aug 23 '17 at 18:15



















    • thank you so much! It worked. Couldn't fix it without you

      – p3pc1styl3
      May 30 '16 at 15:35








    • 2





      @p3pc1styl3 You're very welcome! Please check the check mark next to my answer showing that it helped you and it can help others looking for the same thing. I came up with this because although there are good solutions out there, none of them allowed me to run whatever player I wanted to to watch videos, so I came up with this script to detect anything in full screen mode. Figured that just made it easier. Glad it is helping you! =)

      – Terrance
      May 30 '16 at 16:05











    • Please don't make a ton of edits to your answer over time, Terrance. Only make updates when there's something major to change, a ton of minor edits usually is not a good thing.

      – Thomas Ward
      Aug 23 '17 at 18:13











    • @ThomasWard I understand. I didn't like the old answer I had and I dumped that one. I didn't think there were a ton of minor edits anyway.

      – Terrance
      Aug 23 '17 at 18:14











    • @Terrance Might want to look at the revision history of your answer here then and see how many small revisions you've made over time.

      – Thomas Ward
      Aug 23 '17 at 18:15

















    thank you so much! It worked. Couldn't fix it without you

    – p3pc1styl3
    May 30 '16 at 15:35







    thank you so much! It worked. Couldn't fix it without you

    – p3pc1styl3
    May 30 '16 at 15:35






    2




    2





    @p3pc1styl3 You're very welcome! Please check the check mark next to my answer showing that it helped you and it can help others looking for the same thing. I came up with this because although there are good solutions out there, none of them allowed me to run whatever player I wanted to to watch videos, so I came up with this script to detect anything in full screen mode. Figured that just made it easier. Glad it is helping you! =)

    – Terrance
    May 30 '16 at 16:05





    @p3pc1styl3 You're very welcome! Please check the check mark next to my answer showing that it helped you and it can help others looking for the same thing. I came up with this because although there are good solutions out there, none of them allowed me to run whatever player I wanted to to watch videos, so I came up with this script to detect anything in full screen mode. Figured that just made it easier. Glad it is helping you! =)

    – Terrance
    May 30 '16 at 16:05













    Please don't make a ton of edits to your answer over time, Terrance. Only make updates when there's something major to change, a ton of minor edits usually is not a good thing.

    – Thomas Ward
    Aug 23 '17 at 18:13





    Please don't make a ton of edits to your answer over time, Terrance. Only make updates when there's something major to change, a ton of minor edits usually is not a good thing.

    – Thomas Ward
    Aug 23 '17 at 18:13













    @ThomasWard I understand. I didn't like the old answer I had and I dumped that one. I didn't think there were a ton of minor edits anyway.

    – Terrance
    Aug 23 '17 at 18:14





    @ThomasWard I understand. I didn't like the old answer I had and I dumped that one. I didn't think there were a ton of minor edits anyway.

    – Terrance
    Aug 23 '17 at 18:14













    @Terrance Might want to look at the revision history of your answer here then and see how many small revisions you've made over time.

    – Thomas Ward
    Aug 23 '17 at 18:15





    @Terrance Might want to look at the revision history of your answer here then and see how many small revisions you've made over time.

    – Thomas Ward
    Aug 23 '17 at 18:15













    5














    Youtube doesn't have that problem because it uses HTML5 player. The sites you're having the problem with are using Flash Player instead. It is a bug in Adobe Flashplayer, which, in short, is that it never notifies WM that it ran into fullscreen. You may have heard though that Adobe Flash is a buggy app in general, so one workaround is to disable it, and use only sites with HTML5 video.



    As you mentioned caffeine, you probably have searched for a solution already. Another thing you could do is to disable «power saving» completely, i.e. to force the screen to never turn off.






    share|improve this answer






























      5














      Youtube doesn't have that problem because it uses HTML5 player. The sites you're having the problem with are using Flash Player instead. It is a bug in Adobe Flashplayer, which, in short, is that it never notifies WM that it ran into fullscreen. You may have heard though that Adobe Flash is a buggy app in general, so one workaround is to disable it, and use only sites with HTML5 video.



      As you mentioned caffeine, you probably have searched for a solution already. Another thing you could do is to disable «power saving» completely, i.e. to force the screen to never turn off.






      share|improve this answer




























        5












        5








        5







        Youtube doesn't have that problem because it uses HTML5 player. The sites you're having the problem with are using Flash Player instead. It is a bug in Adobe Flashplayer, which, in short, is that it never notifies WM that it ran into fullscreen. You may have heard though that Adobe Flash is a buggy app in general, so one workaround is to disable it, and use only sites with HTML5 video.



        As you mentioned caffeine, you probably have searched for a solution already. Another thing you could do is to disable «power saving» completely, i.e. to force the screen to never turn off.






        share|improve this answer















        Youtube doesn't have that problem because it uses HTML5 player. The sites you're having the problem with are using Flash Player instead. It is a bug in Adobe Flashplayer, which, in short, is that it never notifies WM that it ran into fullscreen. You may have heard though that Adobe Flash is a buggy app in general, so one workaround is to disable it, and use only sites with HTML5 video.



        As you mentioned caffeine, you probably have searched for a solution already. Another thing you could do is to disable «power saving» completely, i.e. to force the screen to never turn off.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 13 '17 at 12:24









        Community

        1




        1










        answered May 28 '16 at 20:47









        Hi-AngelHi-Angel

        2,22111626




        2,22111626






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • 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%2faskubuntu.com%2fquestions%2f778688%2fwhen-i-watch-a-video-online-the-screen-turns-off-after-a-few-minutes%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

            Human spaceflight

            Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

            張江高科駅