Results 1 to 5 of 5

Thread: Stop Monitor Going to Sleep whilst watching Youtube

  1. #1
    Join Date
    Nov 2009
    Location
    Co Down, N Ireland
    Beans
    125
    Distro
    Ubuntu 14.10 Utopic Unicorn

    Stop Monitor Going to Sleep whilst watching Youtube

    How do I stop my monitor going to sleep when I'm watching a youtube video. It's does it whether I'm fullscreen or not. I'm in Ubuntu 13.10 x64.

    Thanks
    Last edited by ktz84; October 27th, 2013 at 11:33 AM. Reason: Added distro info.

  2. #2
    Join Date
    Jul 2007
    Location
    UK
    Beans
    17,059
    Distro
    Ubuntu Development Release

    Re: Stop Monitor Going to Sleep whilst watching Youtube

    Quote Originally Posted by ktz84 View Post
    How do I stop my monitor going to sleep when I'm watching a youtube video. It's does it whether I'm fullscreen or not. I'm in Ubuntu 13.10 x64.

    Thanks
    system settings > brightness and lock.

    Turn screen off when inactive = never.

  3. #3
    Join Date
    Nov 2009
    Location
    Co Down, N Ireland
    Beans
    125
    Distro
    Ubuntu 14.10 Utopic Unicorn

    Re: Stop Monitor Going to Sleep whilst watching Youtube

    That would do it however not what I'm really looking for as I'd like to the screen to lock after inactivity in most circumstances. If I watch a film or tv show in VLC player in fullscreen the monitor won't go to sleep however if I'm watching YouTube fullscreen it does go to sleep. Is there anyway to prevent this with YouTube.

    Thanks

  4. #4
    Join Date
    Jul 2007
    Location
    UK
    Beans
    17,059
    Distro
    Ubuntu Development Release

    Re: Stop Monitor Going to Sleep whilst watching Youtube

    Quote Originally Posted by ktz84 View Post
    That would do it however not what I'm really looking for as I'd like to the screen to lock after inactivity in most circumstances. If I watch a film or tv show in VLC player in fullscreen the monitor won't go to sleep however if I'm watching YouTube fullscreen it does go to sleep. Is there anyway to prevent this with YouTube.

    Thanks
    I think the problem with youtube is that flash does not follow the same rules as VLC. It should but it doesn't. Same for me with bbc iplayer which uses flash. So I set the option to never then set it back to 10 mins after watching.

    This has been noted for years by the way.

  5. #5
    Join Date
    Dec 2007
    Beans
    12,521

    Re: Stop Monitor Going to Sleep whilst watching Youtube

    This script works for me:
    Code:
    #!/usr/bin/env bash
    
    sleep_period=8m 
    
    while true; do
      if ps -eo %C --sort -%cpu | head -2 | awk 'NR==2 { exit !($1>10); }'; then
          xdotool key shift
      fi
      sleep ${sleep_period}
    done
    It is triggered when the %CPU usage is > 10% which is usually the case when watching videos, whether YouTube or others. A key press is sent by xdotool and that prevents screen blanking. You will need to install xdotool with sudo apt-get install xdotool. The sleep period is set for 8 min but that can be changed as can the %CPU in "{ exit !($1>10); }".

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •