How to Stop Ubuntu from Automatically Locking the Screen When Watching a Movie

Ubuntu Linux employs strict power management rules by default. If you are watching a long movie on VLC Media Player or sitting through a lengthy YouTube documentary without touching the mouse or keyboard, the GNOME desktop environment will assume you have walked away. After a few minutes, it will automatically dim the screen, blank the display, and eventually lock the computer, completely interrupting your video.

While this is great for battery life and office security, it makes using Ubuntu as a media consumption device incredibly frustrating. You should not have to wiggle your mouse every five minutes just to keep the screen awake.

Rather than permanently disabling your system-wide security lock, the best solution is to use a lightweight background utility to temporarily block the lock screen on demand.

How to Use Caffeine to Block the Lock Screen

The most popular tool for this job in the Linux ecosystem is “Caffeine.” It places a small coffee cup icon in your system tray that you can click to instantly override all power and lock screen settings.

  1. Open your terminal application (Ctrl+Alt+T).
  2. Install the utility by running:

sudo apt update && sudo apt install caffeine

  1. Once installed, open your GNOME application launcher and search for Caffeine Indicator. Launch it.
  2. You will now see a small, empty coffee cup icon in the top right corner of your screen (near the Wi-Fi and volume icons).
  3. Before you start watching a movie, click the coffee cup icon and select Activate.

The cup will fill with “coffee” (steam will appear above it). As long as this icon is active, Caffeine will silently send a heartbeat signal to the GNOME desktop, tricking it into thinking you are actively typing. Ubuntu will absolutely refuse to dim, sleep, or lock the screen. When your movie is finished, simply click the icon again and select “Deactivate” to restore your normal security timeouts.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.