When browsing hacker news I stumbled on a nice little script for pausing X11 applications.

Why would I want to pause applications? Well, my use-case is the same as the examples given in the original blog-post (emphasis mine):

Lets say you have Firefox started with many tabs open (50+) and you know that it drains battery life from your laptop. You can close it but when You will need information from any of those tabs, then You will have to start Firefox again (even more battery usage) and load all needed tabs (battery …). The alternative is to pause all Firefox processes when You do not use them. This will freeze all its processes and subprocesses and it will not use any CPU (or battery) power. When you will need it, then you will unpause it without the need to load all tabs again.


My install log on a Lenovo Thinkpad W530 workstation, running a Debian Stretch (9).

  1. The installation directory is ~/bin
  2. Download (and check) the script from github: $ wget https://raw.githubusercontent.com/vermaden/scripts/master/desktop-pause.sh
  3. $ chmod +x ~/bin/desktop-pause.sh
  4. Install dependencies: $ sudo apt install x11-utils xdotool zenity xbindkeys
  5. Create a default configuration for xbindkeys: $ xbindkeys --defaults > ~/.xbindkeysrc
  6. Edit the ~/.xbindkeysrc, add the following lines:
     # [Pause] FOR ACTIVE WINDOW (Fn+P on W530)
     "~/bin/desktop-pause.sh -a"
       Mod2 + Pause
  7. Add xbindkeys to ~/.xinitrc

Future improvements

The script tries to write stats on a nonexistent file/directory. This would be an easy fix, but as the error message is being hidden when run via xbindkey-bind, I’m not going to do anything about it.