After using UNIX for so many years I knew that I could freeze (or pause) any process in the system with kill -17 (SIGSTOP) signal and then unfreeze it with with kill -19 (SIGCONT) signal as I described in the Process Management section of the Ghost in the Shell – Part 2 article. Doing it that way for the desktop applications is PITA to say the least. Can you imagine opening xterm terminal and searching for all Chromium or Firefox processes and then freezing them one by one every time you need it? Me neither.
Fortunately with introduction of so called X11 helper utilities – like xdotool(1) – it is now possible to implement it in more usable manner.
Today I will show you how to freeze any X11 application with single keyboard shortcut or mouse gesture if you utilize them in any way with small simple script.
Handy little trick. The entire series of articles by the same author about FreeBSD on the desktop are interesting and informative reads.
This entire FreeBSD desktop series by Vermaden is a piece of art. My 2 cents: Should be added to the Handbook
Yeah, this is pure gold.
Also thank You
Thank You
I often did the same thing on Windows with Process Explorer – right clicking on process, pausing/unpausing it (helps in low memory situations, too, since the paused process doesn’t demand memory accesses and can be flushed to swap in its entirety
What’s the easiest way to do that under Linux?
Hi.
The desktop-pause.sh script [1] that I use for this pause/unpause supports both FreeBSD and Linux.
[1] https://github.com/vermaden/scripts/blob/master/desktop-pause.sh
Just use the instructions from the article the same way on Linux.
Regards,
vermaden
Great, thank you.
PS. I have a perhaps somewhat related question… how to limit CPU usage of running apps? (I run some old games, and they’re quite “dumb” with CPU usage, taking 100% – which does nothing but wastes battery power, 10% would be enough for those games)
Edited 2018-09-23 13:35 UTC
I think the answer is nice. More info: https://linux.die.net/man/1/nice
Or cgroups and CPU quotas via some systemd crap. Or something like that. At least on Linux.
Edited 2018-09-24 20:17 UTC
Hm, not sure if affected process scheduling will effect in what I hope for, a “use max xx% CPU” hard cap, but I’ll check it out; also thank you. (I wonder if there’s some way to do that on Windows… not all of my old games run fine under Wine)
I’ve quite frequently used it to stop multiple running instances of apps, for example (killall -STOP java) or (killall -CONT java) to fully halt and later rejoin minecraft in the background (without quitting) while needing to do something more intensive for several minutes