Skip to content

Instantly share code, notes, and snippets.

@ptrcnull
Created January 25, 2022 02:16
Show Gist options
  • Save ptrcnull/5efc9070acf414506c1e79756604d2b3 to your computer and use it in GitHub Desktop.
Save ptrcnull/5efc9070acf414506c1e79756604d2b3 to your computer and use it in GitHub Desktop.
Script to toggle SIGSTOP/SIGCONT on all sway GUI processes
#!/bin/sh
pids="$(swaymsg -t get_tree | grep pid | grep -oE '[0-9]+')"
first=$(echo "$pids" | head -n 1)
if grep -q stopped "/proc/$first/status"; then
sig=CONT
else
sig=STOP
fi
for pid in $pids; do kill -$sig $pid; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment