hwatch icon indicating copy to clipboard operation
hwatch copied to clipboard

[FR]: Quit without dialog on Ctrl-C

Open ilyagr opened this issue 1 year ago • 9 comments

https://github.com/blacknon/hwatch/issues/110 implemented a confirmation dialog on exit. I think it is nice, but I think that Ctrl-C should just exit unconditionally. It can be labeled as a separate key binding for "quit immediately".

The original plan with https://github.com/blacknon/hwatch/issues/110 seems to have been to include an option for disabling the dialog. This seems at least partially implemented, but I couldn't find the documentation.

Regardless, after a bit of thought, I think that the confirmation dialog by default is nice, since q can be hit accidentally, but having Ctrl-C override it would both be intuitive, and there wouldn't really be a need for an option if that's implemented.

ilyagr avatar Jun 10 '24 20:06 ilyagr

I also appreciate how q q quits, nice idea! Currently, however, Ctrl-C Ctrl-C does not quit.

ilyagr avatar Jun 10 '24 20:06 ilyagr

Another, minor, suggestion: Esc could close the dialog. Esc could also close the help dialog.

More significantly, perhaps q q should the documented. The dialog could say:

Exit hwatch?
  Y, Q  : Quit
  N, Esc: Stay

with Y,Q,N,Esc bold or highlighted.

It could also maybe say, as a footnote, "Use Ctrl-C to skip this dialog"

ilyagr avatar Jun 10 '24 20:06 ilyagr

That maybe. That might be more naturally.

Change the default behavior while still leaving room for customization with options.

blacknon avatar Jun 11 '24 03:06 blacknon

Looking at the keybinds, I think Esc and maybe Ctrl-G (for Emacs-lovers) should be "cancel", and Ctrl-C should be "abort". I think both Esc and Ctrl-G could be called cancel dialog or filter.

Of these, I feel that having Ctrl-C as a mild "cancel" (as it is now) is quite surprising, so it should be changed IMO. The rest of my suggestions seem natural to me but are more arguable/lower priority (again, IMO of course).

ilyagr avatar Jun 11 '24 05:06 ilyagr

this done. I think it will probably work as you comments.

blacknon avatar Jun 18 '24 16:06 blacknon

Thank you very much!

What you implemented is pretty close to what I wanted, with one major difference. I would prefer it if pressing Ctrl-C once would exit hwatch, and perhaps return the SIGINT error code. Currently, if you press h, you have to then press Ctrl-C three times to quit.

However, I don't insist on making this change. While I think that would be a slight improvement, I also think things are pretty good already; they no longer feel counterintuitive and it's now easy to discover that q q quits.

ilyagr avatar Jun 19 '24 03:06 ilyagr

What you implemented is pretty close to what I wanted, with one major difference. I would prefer it if pressing Ctrl-C once would exit hwatch, and perhaps return the SIGINT error code. Currently, if you press h, you have to then press Ctrl-C three times to quit.

How about adding a process to the keymap to handle this? 🤔

blacknon avatar Jun 19 '24 08:06 blacknon

I checked, and it seems like regular watch quits with 0 error code on Ctrl-C. So, I think creating a "quit without confirmation" command and mapping Ctrl-C to it would work.

ilyagr avatar Jun 20 '24 03:06 ilyagr

Now, let's create a key function so that we can set it up with a custom keymap. shall we manage it in a new issue.

blacknon avatar Jun 24 '24 01:06 blacknon

This issue will be closed for the time being as we will take further action in #138.

blacknon avatar Oct 13 '24 10:10 blacknon