
I have a small NUC-style mini PC that runs linux with X11, and I cannot suspend it — probably some hardware incompatibility or BIOS bug, as is often the case on these mini-PCs. So, to minimize power consumption and heat generation, I made browser-freezer: a small and light utility to freeze the browsers when the screen blanks, and un-freeze them on wakeup. On such a machine, the browser is the only thing consuming power when not being used.
Why two parts? C + bash🔗
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.
Wayland🔗
The initial release was X11 only, but two weeks later I added a Wayland variant: a second binary browser-freezer-wayland and a wrapper that picks the right one at login depending on $WAYLAND_DISPLAY. As always with Wayland, it is a second incompatible API to implement, but it works.
My browsers are the only things consuming power on that machine when idle, so freezing them is the next best thing to suspending the whole PC. Indeed :-)
Installation, Usage, and more info🔗
See the browser-freezer repository.
Some code and images generated by AI (Gemini), as my C was a bit rusty.