Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support additional keybind to exit #27

Open
jarun opened this issue Jun 4, 2017 · 5 comments
Open

Support additional keybind to exit #27

jarun opened this issue Jun 4, 2017 · 5 comments
Assignees

Comments

@jarun
Copy link

jarun commented Jun 4, 2017

I am trying to integrate termsaver in nnn as the default termsaver. I am facing 2 problems:

  • nnn disables ^C at start. Would it be possible to support an additional keybind to exit termsaver? Perhaps ^Q?

  • termsaver clears the terminal on exit. However, I need to restore the nnn window.

@jarun
Copy link
Author

jarun commented Jun 4, 2017

I could get around the first problem by restoring the default signal handler before spawning termsaver. Can you handle the second issue?

@brunobraga
Copy link
Owner

The clearing of the screen was a default behavior to "start the terminal over"... I can see 2 easy way outs here (both require coding though):

  1. add an option to avoid clearing the terminal on exit (this might leave the dirt from the screensaver work though, I think this is less elegant)
  2. Add hooks to termsaver, to allow you to extend how you want it to start/finish (eg. call another script, etc), then it's your choice on what you want to do with it.

Any interest in contributing to the code? Otherwise I will add this to the bucket list :-)

@jarun
Copy link
Author

jarun commented Jun 4, 2017

I think it would be great to use an alternative like curses, so that there are no incremental prints and user is in his context when he quits. For the time being I chose vlock which keeps the screen clean.

Any interest in contributing to the code? Otherwise I will add this to the bucket list :-)

I would be glad to do so but am on a constant time crunch myself due to around 7 live projects.

@brunobraga
Copy link
Owner

yeah, curses is very good, I just wanted to keep it simple with stdout, which worked just fine but no doubt floods the terminal screen... Switching to curses is a bit of redesign, but something to consider depending on the screensaver (I actually haven't seen much need for it, apart from making Matrix flow downward instead of upward, lol).

Thanks anyway. Will leave this open and when I can work on it, will add the hooks functionality, might help others in doing more stuff with this as well.

@jarun
Copy link
Author

jarun commented Jun 5, 2017

And I almost missed it, nnn uses ncurses too. Though it's in C you may be able to take some cues from the initcurses() and existcurses() functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants