|
|
|
|
|
by Arnavion
1610 days ago
|
|
You can do it for sway too. `swaymsg -t subscribe -m '["window"]'` will send you an event every time focus changes, from which you can get the ID and PID of the newly focused window. However the script will have to track the previously-focused-now-unfocused window itself (which the ID is useful for). Care will also have to be taken to handle the case when focus moves to a container rather than a window. I use a similar SIGSTOP/SIGCONT script myself, but it's for when I turn my desktop PC's monitors off for the night rather than focus changes. It uses `swaymsg -t subscribe -m '["workspace"]'` for `"move"` events; when windows move to the "NOOP-1" workspace their processes get SIGSTOP'd, and when they move from the "NOOP-1" workspace their processes get SIGCONT'd. |
|