rmkit-dev / rmkit

| remarkable app framework | https://rmkit.dev
https://build.rmkit.dev
365 stars 32 forks source link

[remux] try stopping apps with SIGTERM before SIGKILL #79

Open mrichards42 opened 3 years ago

mrichards42 commented 3 years ago

I'm hoping to add some cleanup code in remarkable_puzzles (like saving the current puzzle state before exit). Currently it looks like the "kill" button in remux uses SIGKILL, which is impossible to handle. It looks like oxide tries SIGTERM 5 times before giving up and sending SIGTERM.

raisjn commented 3 years ago

the reason for SIGTERM is that the flow is:

if we change to using SIGTERM, then it would look like:

the problem i was trying to avoid is a misbehaving app drawing to the screen after it is killed, but maybe the solution is to then do:

(i'm pretty sure i asked Eeems about this in the past and the screenshot was one solution)

mrichards42 commented 3 years ago

Ah, got it that makes sense. I'm just looking for some signal I can catch when the process is either suspended or killed, although now that I think about it, this is probably a broader launcher conversation since it would be nice if all the launchers used a similar process for suspending or killing.

raisjn commented 3 years ago

killing only happens when you click the memory button to kill the app, so i'm not sure this is where we want to install the event. suspending seems like a better place to put it (esp. since you need to go suspend state to show remux in the first place).

agree that talking to other launcher devs make sense and i'm open for proposals on how to notify apps of suspend events (as long as the behavior won't be too wonky)

raisjn commented 3 years ago

SIGTSTP is used for interactive programs (^Z), but isn't working with an immediate swap for SIGSTOP

raisjn commented 3 years ago

i want to re-visit getting SIGTSTP to work because it's catchable