Sending SIGSTOP or SIGCONT signals graphically (similar to xkill)

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
1
down vote

favorite












Question



Do you know any tool/script to send SIGSTOP (to pause a process) or SIGCONT (to resume it) to a process by clicking on a graphical window generated by the process?



Some context



There is already a tool called xkill which kills programs by clicking on a window, but it has no options to send a particular signal. This is a pity, because somewhat related command-line tools like kill have this option.



Usually I do this via command line by manually obtaining the corresponding process names and using tools like kill, pkill or killall but it would be nice to be able to do this graphically, in a way similar to clicking on a window with the xkill tool.



Applications



I would find such a tool very useful to graphically pause some heavy processes when the CPU is too "stressed" without terminating them and without losing data which cannot be saved (e.g. for partial results of long calculations).







share|improve this question


























    up vote
    1
    down vote

    favorite












    Question



    Do you know any tool/script to send SIGSTOP (to pause a process) or SIGCONT (to resume it) to a process by clicking on a graphical window generated by the process?



    Some context



    There is already a tool called xkill which kills programs by clicking on a window, but it has no options to send a particular signal. This is a pity, because somewhat related command-line tools like kill have this option.



    Usually I do this via command line by manually obtaining the corresponding process names and using tools like kill, pkill or killall but it would be nice to be able to do this graphically, in a way similar to clicking on a window with the xkill tool.



    Applications



    I would find such a tool very useful to graphically pause some heavy processes when the CPU is too "stressed" without terminating them and without losing data which cannot be saved (e.g. for partial results of long calculations).







    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Question



      Do you know any tool/script to send SIGSTOP (to pause a process) or SIGCONT (to resume it) to a process by clicking on a graphical window generated by the process?



      Some context



      There is already a tool called xkill which kills programs by clicking on a window, but it has no options to send a particular signal. This is a pity, because somewhat related command-line tools like kill have this option.



      Usually I do this via command line by manually obtaining the corresponding process names and using tools like kill, pkill or killall but it would be nice to be able to do this graphically, in a way similar to clicking on a window with the xkill tool.



      Applications



      I would find such a tool very useful to graphically pause some heavy processes when the CPU is too "stressed" without terminating them and without losing data which cannot be saved (e.g. for partial results of long calculations).







      share|improve this question














      Question



      Do you know any tool/script to send SIGSTOP (to pause a process) or SIGCONT (to resume it) to a process by clicking on a graphical window generated by the process?



      Some context



      There is already a tool called xkill which kills programs by clicking on a window, but it has no options to send a particular signal. This is a pity, because somewhat related command-line tools like kill have this option.



      Usually I do this via command line by manually obtaining the corresponding process names and using tools like kill, pkill or killall but it would be nice to be able to do this graphically, in a way similar to clicking on a window with the xkill tool.



      Applications



      I would find such a tool very useful to graphically pause some heavy processes when the CPU is too "stressed" without terminating them and without losing data which cannot be saved (e.g. for partial results of long calculations).









      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 23 at 18:56

























      asked Apr 23 at 18:21









      Kubuntuer82

      402213




      402213




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          You can use xdotool to allow the user to click a window and obtain its process ID. Then you can use kill to send e.g. the STOP or CONT signals to that process and freeze/thaw it that way.



          First, you probably have to install xdotool, as it doesn't come preinstalled:



          sudo apt install xdotool


          Then, the command to get the PID of the process owning a specific window, which can be selected by clicking with the mouse, would be:



          xdotool selectwindow getwindowpid


          This prints the numeric process ID. You can use supply it as argument to kill -STOP or kill -CONT to pause and continue said process. This can be simplified by storing the PID in a variable, like in this little script below, which pauses the clicked window's process for 5 seconds:



          #!/bin/bash
          wpid="$(xdotool selectwindow getwindowpid)"
          kill -STOP "$wpid"
          sleep 5
          kill -CONT "$wpid"


          You could now save this script on your computer and e.g. bind it to a keyboard shortcut.




          Note: man xdotool says about the getwindowpid subcommand:




          "This requires effort from the application owning a window and may not work for all windows."




          In other words, it might not work at all or at least not exactly as intended with some applications.

          It could also happen that multiple windows have the same corresponding process ID, like e.g. all gnome-terminal instances are owned by the same parent. In that case, the command would freeze all of them, which might not be intended.







          share|improve this answer




















          • Just tested, it works perfectly, thanks!
            – Kubuntuer82
            Apr 23 at 20:45










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "89"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1027547%2fsending-sigstop-or-sigcont-signals-graphically-similar-to-xkill%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          You can use xdotool to allow the user to click a window and obtain its process ID. Then you can use kill to send e.g. the STOP or CONT signals to that process and freeze/thaw it that way.



          First, you probably have to install xdotool, as it doesn't come preinstalled:



          sudo apt install xdotool


          Then, the command to get the PID of the process owning a specific window, which can be selected by clicking with the mouse, would be:



          xdotool selectwindow getwindowpid


          This prints the numeric process ID. You can use supply it as argument to kill -STOP or kill -CONT to pause and continue said process. This can be simplified by storing the PID in a variable, like in this little script below, which pauses the clicked window's process for 5 seconds:



          #!/bin/bash
          wpid="$(xdotool selectwindow getwindowpid)"
          kill -STOP "$wpid"
          sleep 5
          kill -CONT "$wpid"


          You could now save this script on your computer and e.g. bind it to a keyboard shortcut.




          Note: man xdotool says about the getwindowpid subcommand:




          "This requires effort from the application owning a window and may not work for all windows."




          In other words, it might not work at all or at least not exactly as intended with some applications.

          It could also happen that multiple windows have the same corresponding process ID, like e.g. all gnome-terminal instances are owned by the same parent. In that case, the command would freeze all of them, which might not be intended.







          share|improve this answer




















          • Just tested, it works perfectly, thanks!
            – Kubuntuer82
            Apr 23 at 20:45














          up vote
          1
          down vote



          accepted










          You can use xdotool to allow the user to click a window and obtain its process ID. Then you can use kill to send e.g. the STOP or CONT signals to that process and freeze/thaw it that way.



          First, you probably have to install xdotool, as it doesn't come preinstalled:



          sudo apt install xdotool


          Then, the command to get the PID of the process owning a specific window, which can be selected by clicking with the mouse, would be:



          xdotool selectwindow getwindowpid


          This prints the numeric process ID. You can use supply it as argument to kill -STOP or kill -CONT to pause and continue said process. This can be simplified by storing the PID in a variable, like in this little script below, which pauses the clicked window's process for 5 seconds:



          #!/bin/bash
          wpid="$(xdotool selectwindow getwindowpid)"
          kill -STOP "$wpid"
          sleep 5
          kill -CONT "$wpid"


          You could now save this script on your computer and e.g. bind it to a keyboard shortcut.




          Note: man xdotool says about the getwindowpid subcommand:




          "This requires effort from the application owning a window and may not work for all windows."




          In other words, it might not work at all or at least not exactly as intended with some applications.

          It could also happen that multiple windows have the same corresponding process ID, like e.g. all gnome-terminal instances are owned by the same parent. In that case, the command would freeze all of them, which might not be intended.







          share|improve this answer




















          • Just tested, it works perfectly, thanks!
            – Kubuntuer82
            Apr 23 at 20:45












          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          You can use xdotool to allow the user to click a window and obtain its process ID. Then you can use kill to send e.g. the STOP or CONT signals to that process and freeze/thaw it that way.



          First, you probably have to install xdotool, as it doesn't come preinstalled:



          sudo apt install xdotool


          Then, the command to get the PID of the process owning a specific window, which can be selected by clicking with the mouse, would be:



          xdotool selectwindow getwindowpid


          This prints the numeric process ID. You can use supply it as argument to kill -STOP or kill -CONT to pause and continue said process. This can be simplified by storing the PID in a variable, like in this little script below, which pauses the clicked window's process for 5 seconds:



          #!/bin/bash
          wpid="$(xdotool selectwindow getwindowpid)"
          kill -STOP "$wpid"
          sleep 5
          kill -CONT "$wpid"


          You could now save this script on your computer and e.g. bind it to a keyboard shortcut.




          Note: man xdotool says about the getwindowpid subcommand:




          "This requires effort from the application owning a window and may not work for all windows."




          In other words, it might not work at all or at least not exactly as intended with some applications.

          It could also happen that multiple windows have the same corresponding process ID, like e.g. all gnome-terminal instances are owned by the same parent. In that case, the command would freeze all of them, which might not be intended.







          share|improve this answer












          You can use xdotool to allow the user to click a window and obtain its process ID. Then you can use kill to send e.g. the STOP or CONT signals to that process and freeze/thaw it that way.



          First, you probably have to install xdotool, as it doesn't come preinstalled:



          sudo apt install xdotool


          Then, the command to get the PID of the process owning a specific window, which can be selected by clicking with the mouse, would be:



          xdotool selectwindow getwindowpid


          This prints the numeric process ID. You can use supply it as argument to kill -STOP or kill -CONT to pause and continue said process. This can be simplified by storing the PID in a variable, like in this little script below, which pauses the clicked window's process for 5 seconds:



          #!/bin/bash
          wpid="$(xdotool selectwindow getwindowpid)"
          kill -STOP "$wpid"
          sleep 5
          kill -CONT "$wpid"


          You could now save this script on your computer and e.g. bind it to a keyboard shortcut.




          Note: man xdotool says about the getwindowpid subcommand:




          "This requires effort from the application owning a window and may not work for all windows."




          In other words, it might not work at all or at least not exactly as intended with some applications.

          It could also happen that multiple windows have the same corresponding process ID, like e.g. all gnome-terminal instances are owned by the same parent. In that case, the command would freeze all of them, which might not be intended.








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 23 at 19:25









          Byte Commander

          59.2k26159267




          59.2k26159267











          • Just tested, it works perfectly, thanks!
            – Kubuntuer82
            Apr 23 at 20:45
















          • Just tested, it works perfectly, thanks!
            – Kubuntuer82
            Apr 23 at 20:45















          Just tested, it works perfectly, thanks!
          – Kubuntuer82
          Apr 23 at 20:45




          Just tested, it works perfectly, thanks!
          – Kubuntuer82
          Apr 23 at 20:45

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1027547%2fsending-sigstop-or-sigcont-signals-graphically-similar-to-xkill%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          pylint3 and pip3 broken

          Missing snmpget and snmpwalk

          How to enroll fingerprints to Ubuntu 17.10 with VFS491