k9s icon indicating copy to clipboard operation
k9s copied to clipboard

Use Q for quitting the app

Open k8s-gpubuilder-markus opened this issue 2 years ago • 9 comments

Could you make it possible to use q for quitting the app like it is the standard on pretty much any other Linux app?

So far I had to do CTRL C to get out of it. Quitting should be really easy and intuitive.

k8s-gpubuilder-markus avatar Apr 27 '22 18:04 k8s-gpubuilder-markus

If you bring up the command palette with : you can hit q to quit. That's in line with almost all other commands that are possible within the app (see key bindings).

I think the only time they use keys without modifiers is for direct contextual actions. For instance, if you're looking at a Pod, you can do a few things:

  • d = describe
  • e = edit
  • l = view logs
  • s = get a shell
  • etc

nublarsec avatar Apr 28 '22 17:04 nublarsec

Why do I have to use : ? How can this ever make sense to anybody else than a VIM user? Any app should provide a easy intuitive way to quit it, which is normally q or ESC. Intuitive as in: I don't have to RTFM to know this. In my opinion, quitting an app is an universal function that must always be available. Would you mind making k9s usable for a wider audience of users by adding the q option?

k8s-gpubuilder-markus avatar Apr 28 '22 19:04 k8s-gpubuilder-markus

Perhaps this should be a matter of clearly documenting or otherwise advertising how to quit? I think the criticism of vim from new users is not how you quit, but rather it not communicating how to do so.

Just want to cover all options in case others agree with the command palette approach. As a heads up, you can also quit with ctrl+c.

caproven avatar May 11 '22 19:05 caproven

I just want to chime in that I also expected q to quit the app, as nothing in the default GUI told me otherwise, only attach, describe, kill etc. Nor did anything tell me about the : command palette, unless I opened "help" (which also told me how to quit it).

If q is not bound to anything currently, would it be possible to bind it to quit? Or bind a "help" function to it, to tell a user how to quit? Or if it can be a "misclick" often, maybe require confirmation (press q again to quit).

A lot of terminal tooling taking up the full terminal session supports quitting with q, such as less(1), top(1), man(1), tig(1).

I would be willing to contribute this feature if it can be accepted.

sklirg avatar May 23 '22 09:05 sklirg

Any app should provide a easy intuitive way to quit it, which is normally q or ESC. I

provide examples? I do not think there is a universal method that always works. Curses application typically all have various bespoke methods and at least Vim is a well known bespoke method. ALT-F4 will not work. Lets enumerate those few applications that I still use or "recently" used.

  • nano uses CTRL-X to quit. ctrl-c will not work!
  • mc midnight commander is F10 (which has its own challenges in a desktop terminal which captures F10 typically.). ctrl-c will not work!
  • top/htop uses "q" to close the application. but ESC and CTRL-X does nothing. CTRL-C however closes the app
  • aws-shell uses F10 or ".quit" to quit. ctrl-c will not work, however empty line ctrl-d will work!
  • mutt uses "q" to quit, unexpectedly. neither ":quit" nor ":exit" will work. ctrl-c will quit with confirmation.
  • tig both :quit and Q will work, as well as CTRL-C
  • ranger q or Q will quit the application as well as CTRL-C (same as tig)
  • irssi irc client: only /quit will work (ctrl-c does nothing)
  • k9s: ctrl-c and :quit will quit the application. Q does nothing. note that CTRL-C is undocumented way to quit?
  • bmon: q will quit with confirmation. ctrl-c quits w/o confirmation.
  • emacs: ctrl-x ctrl-c (that is the oddest one of them all IMHO)

hholst80 avatar Jun 09 '22 20:06 hholst80

One way an app can become "intuitive" is by properly documenting it, for example nano just plainly says how to exit on screen.

I see CTRL - C as a non clean way to terminate an app: most more advanced apps will not allow it, as it is mostly a convention for CLI tools to terminate them. In a GUI tool, CTRL - C will be mapped to copy (paste).

k8s-gpubuilder-markus avatar Jun 10 '22 22:06 k8s-gpubuilder-markus

The k9s header always show the "help" shortcut which then shows how to quit (displays ":q" in the help screen). Might not be the most intuitive, but it is at least documented in the UI.

Could an entry for "quit" always displaying in the header help? Alternatively, it seems "q" is currently unbound so it could certainly bound as a dedicated "quit" key. Not sure how I feel about both "q" and ":q" being used, if "q" is added should the other be removed?

caproven avatar Jun 11 '22 18:06 caproven

With hotkey features, it works by adding this snippet to $HOME/.config/k9s/hotkeys.yaml: (path may differ)

hotKeys:
  quit-app:
    shortCut:    q
    description: Quit
    command:     quit

snowphone avatar Jan 26 '24 21:01 snowphone