Open PartyWumpus opened 1 year ago
@PartyWumpus Can you briefly describe the benefits of adding something like this to the memory-deck plugin?
Technically speaking it seems pretty simple to add, just wondering if it would benefit the plugin itself.
(would require
import signal
, but it's an inbuilt package so no worries)os.kill(pid, signal)
can send a signal (signal.SIGSTOP
for example) to any application. (ignore the name, it can do things other than kill)A list of valid signals to select from can be generated with
signal.valid_signals()
(it produces a set ofSignals
, which have avalue
which is the number of the signal (19, 20, etc), aname
which is the signal name (SIGCONT, SIGKILL, etc). The set also includes a bunch of ints (on my PC, 35-63) that do not have any associated function, these should probably just be skipped. (64 does have a use on my PC)for reference, all of these work (where 99 is the PID):
os.kill(99, signal.SIGSTOP)
,os.kill(99, signal.SIGSTOP.value)
andos.kill(99, 19)
. these will NOT work:os.kill(99, "SIGSTOP")
andos.kill(99, signal.SIGSTOP.name)
I would think a dropdown menu with every valid signal (by name, not number) and a "send" button next to it would be good.
I considered making this a seperate plugin, but it's not very complex and also fits pretty well into the functionality of this plugin. I will try work on a PR myself (and may fail, we'll see) if you'd like, but I would prefer to hear some feedback (or if you'd like to do it) before I try.
Quick example code for getting a dictionary of signals:
Example code for pausing an application then instantly starting it again
code does not work from within flatpak vscode, probably due to sandboxing works fine otherwise