News for hackers. Stuff that matters.
Re:Show HN: Universal Pause Button by iwalton3 on Tuesday June 09, 2015 @10:01PM (#9689617)
Here is a quick clone of this project for Linux using the STOP and CONT signals:

  #!/bin/bash
  
  currentProcess=$(xprop -id $(xprop -root | grep -F '_NET_ACTIVE_WINDOW(WINDOW)' | awk '{print $5}') | grep -F '_NET_WM_PID(CARDINAL)' | awk '{print $3}')
  
  state=$(grep 'State:' /proc/$currentProcess/status | awk '{print $2}')
  
  if [[ "$state" == "T" ]]
  then
      kill -CONT $currentProcess
  else
      kill -STOP $currentProcess
  fi

There are no comments on this comment yet.