Skip to content

Repository files navigation

Browser Freezer

browser-freezer is a small and light utility to freeze (stop) browsers when screen blanks on linux under X11 or Wayland.

I have a small NUC-style mini PC that I run on linux with X11 (Xubuntu), but I cannot suspend it, because of probably some hardware incompatibilities or BIOS bugs as it is often the case on these mini-PCs. So, in order to minimize power consumption and heat generation, I made this small utility to freeze the browser when the screen blanks, and un-freeze it on wakeup. The reason being that on such a machine, the browser is the only thing consuming power when not being used.

It is composed of two parts:

  • a tiny C daemon browser-freezer that polls the state of the monitor (On / Off) with as less CPU usage as possible (no forks under X11)
  • on monitor status change detection, it runs the bash script browser-freezer-signal that sends the SIGSTOP or SIGCONT signal to all browser processes (firefox by default). It uses a bash script for the most possible flexibility and customization, as performance is not an issue there.

Installation

Running INSTALL compiles and installs in /usr/local/bin, using sudo if needed. If you want to install elsewhere, give the install directory as argument, e.g: INSTALL ~/.local/bin

It restarts browser-freezer and browser-freezer-wayland if they were already running and were an older version. But they do not start them if they were not already running.

Updating is thus updating your copy of this repository and running INSTALL.

./INSTALL

Make browser-freezer (*) a startup application for your desktop. For instance, in XFCE, via the "Startup Applications" dialog in the Settings, where you can add /usr/local/bin/browser-freezer to be run on logins.

(*) Note that browser-freezer only works under X11. You may want to make browser-freezer-wayland the startup application if you use Wayland, or browser-freezer-x11-or-wayland a wrapper script that choses which of them to execute on startup if you may be using both types of sessions.

For instance, creating a ~/.config/autostart/browser-freezer.desktop file:

[Desktop Entry]
Type=Application
Exec=/usr/local/bin/browser-freezer
Name=Browser Freezer
Comment=Freezes browser when idle
Terminal=false
StartupNotify=false

Configuration

The list of browsers can be set in your .config/browser-freezer.conf file, as a bash array "browsers" of bash globbing patterns on the executable path of your browser. Take care of enclosing the paths in quotes if you use globbing chars (star, question marks, square brackets...)

E.g:

browsers=(
    '/usr/lib/firefox/firefox*'
    '*/usr/lib/chromium-browser/chrome'
    opt/google/chrome/chrome
)

Usage

Just ensure that browser-freezer is run in background, with access to your DISPLAY. browser-freezer will call browser-freezer-signal on screenblanking state changes to freeze or unfrezze the configured browsers.

Also:

  • browser-freezer-signal just lists the process of the managed browser(s) with their status: T for freezed. Useful to test your configuration.
  • browser-freezer-signal f frezzes the managed browser(s)
  • browser-freezer-signal u un-frezzes the managed browser(s)

License

MIT License, do what you want with this.

(c) 2026 Colas Nahaboo, with some code and images generated by AI (Gemini), as my C was a bit rusty.

History

  • 2026-06-07 Works also under wayland, with the addition of browser-freezer-wayland.c and browser-freezer-x11-or-wayland
  • 2026-05-24 Initial release, works only with X11

About

A small and light utility to freeze (stop) browsers when screen blanks on linux

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages