ayn2op/discordo

Support ^Z suspend (as config.yml option?)

Opened this issue · 2 comments

from https://raw.githubusercontent.com/ayn2op/discordo/main/internal/config/config.yml there is:

keys:
 suspend: ^Z

Could this handle an option to allow for suspending the process with the standard bash ^Z, e.g., as in /etc/nanorc:

## If you want to suspend nano with one keystroke (instead of with ^T^Z):
bind ^Z suspend main

In response to being asked what my use-case is on Discord:

My use-case is simple, I just want to be able to access discord from the terminal.
After I got signed into discord and saw that discordo populated, etc., the first thing I did was hit ^Z.
I use ^Z/suspend to such an extent that the minor inconvenience of having ^T^Z instead of ^Z is something I fix in nano before I start using a freshly-installed system.
I use screen a lot for stuff I want to do in the background and thus it really isn't something I want to mix in a suspended job.
(e.g., converting from .m4b to .opus is a job I do on my server on the ram drive, usually remotely. Since it is remote, I run it on screen so it won't stop if my remote connection is severed.)

Anyway, it looks like discordo can do what I was looking for it to do otherwise, but unfortunately, the ^Z thing—which amounts to a personal idiosyncracy—really is a deal breaker for me.

^Z Is actually used to "undo" text, the same thing which happens in GUI applications.
I think (not sure) tcell is the one who controls that.

You can try to add an option to the tcell package and add the code

p, err := os.FindProcess(os.Getpid)
if err != nil{
  // PANIC
  return
}
p.Signal(SIGTSTP)

and add an option which will suspend the current process when a ^Z is pressed.
Then you can support this option in Discordo.