How to prevent the screen lock while watching video (Netflix, Youtube, Amazon Prime) in Ubuntu 17.10

In earlier Ubuntu versions like 16.04 and 17.04 while watching YouTube videos in full-screen mode, the screen would not get locked automatically.

In Ubuntu 17.10 while watching videos in browser, system is getting locked. So Ubuntu 17.10 is considering this scenario as user is not doing anything.

Kindly suggest a solution for that.


Solution 1:

The reason that this does not work any more is because 17.10 is the first ubuntu release that uses wayland as its display server. It looks like preventing screen lock is an entirely missing feature in Xwayland.

It has been filed as a bug in Ubuntu and hopefully will be fixed soon. If you're affected by this bug, please click the launchpad link below and click "Does this bug affect you?" to increase the bug priority.

https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+bug/1697373

As a workaround, you could also select "GNOME on X.org" as your session type when logging on.

There is also a bug in chromium, but it seems to apply only for google hangouts sessions:

https://bugs.chromium.org/p/chromium/issues/detail?id=783737

Solution 2:

You may have to use the great Caffeine, available from here. You have to allow installing extension from Firefox or install the Ubuntu package gnome-shell-extension-caffeine thanks to the command apt. This extension detect any full screen application and prevent from running screensaver. It also adds a small cup beside your volume icon, letting you to disable the screen saver with one click.

Apt method

Open your Terminal, and type

sudo apt install gnome-shell-extension-caffeine

Then go to Gnome Tweak, click on Extensions tab, and enable Caffeine

Gnome Shell extension

Open https://extensions.gnome.org/extension/517/caffeine/ from Firefox, click on Allow from the top bar asking for Gnome Shell Integration. Enable then Caffeine extension.

Solution 3:

You may try a GNOME shell extension as a workaround called Keep awake!

Product description:

Keep your computer awake! Forbid your computer to activate sceensaver, turn off the screen or suspend when it is idle for a while. Toogle [sic] this option on or off with one click.

Once you install this extension you'll see an "eye" icon in your top bar.

enter image description here
(screenshot source: extension's homepage at extensions.gnome.org)

Clicking on the eye will switch between "normal" and "no screen-lock or suspend" mode.


Another advanced extension which does the same but provides more customisability is Caffeine.

Warning: There is (or was, not sure whether it's fixed already) a bug in Caffeine which may freeze your computer for ~30 seconds after clicking on the power-off button in the status menu.