3 ms·
On i3, with `i3-msg -m -t subscribe '["window"]'` you can get events when you change focus. With that and possibly the aid of `i3-msg -t get_tree` or some gener
by jolmg 4y ago
On i3, with `i3-msg -m -t subscribe '["window"]'` you can get events when you change focus. With that and possibly the aid of `i3-msg -t get_tree` or some generic X utility like `xdotool search --onlyvisible \^`, you should be able to figure out which windows are hidden and which aren't. With `wmctrl -lp` you can match window ids to process ids and send whatever signals you want from a daemon script.
> There was a time when it was desirable to make room on the visible desktop while keeping long running processes running, but today we have lots of desktop real-estate and few legitimate long running processes, instead web pages leaching CPU cycles (I look at you, github!).
That probably depends on the person. It's not weird for me to have a web server running in the foreground of a terminal that's sometimes hidden. If it's stopped, it's not going to respond to my requests. It's in the foreground because there are times where it'll provide me a console to inspect the running state of the backend.
Same when I'm running an strace on a PID. Sometimes that terminal gets hidden. If that's stopped, the program whose PID I'm tracing is going to get frozen at some point.
- guenthert 4y agoYou could run the web server (or other long running processes) within screen in the terminal, but yeah, that's stretching it. I look into i3, thanks!
- jolmg 4y agoIf your concern are webpages, you should first try sending SIGSTOP manually to some PID. Stopping a particular webpage may not be doable by stopping PIDs. There's nothing stopping multiple processes being involved in managing multiple windows non-exclusively (i.e. not only can a process manage multiple windows, a window can be managed by multiple processes). Your web browser may be beast enough to really complicate what you're trying to do.