Closed szczja closed 2 years ago
Maybe there should be a configuration option like warn_before_quitting
which people can set to false
if they don't want a warning.
A configuration option would be best. I can add this eventually, or would accept a PR for it.
I've implemented this in a fork (https://github.com/tteeoo/amfora/tree/warn-before-quitting), and it works, but I came across some behavior that made me do it in a slightly odd way (perhaps I just don't know the codebase/libraries well enough). When you call the Stop()
function inside of a goroutine (which it seems you need to do to create a cview modal), the interface clears but then hangs: the display.App.Run()
call in amfora.go
never returns. I have got it working by calling os.Exit(0)
after Stop()
(https://github.com/tteeoo/amfora/commit/2097c3556aabe99d096563899f4d0635cef88973#diff-2a7077cf21b905f6c5f6c3cf5c971bb380a4e47b89a21701daeb45ce7a89a12bR215), although this seems clumsy to me. @makeworld-the-better-one do you have any suggestions as to how I can do this in a cleaner way? I can submit a PR if you think it's fine.
@tteeoo ideally you shouldn't need to that. I'm not sure what the solution is right now, but if I figure it out I'll let you know.
Totally agree with the @szczja's remark, how many times I closed Amfora accidentally, I can't even count them it became a real problem. The letter "q" is used for many things elsewhere that it's almost a habit to use it, sometimes I want to close a tab and hit q and then ... it's a total disaster I lose everything ^_^ May be just by switching it to "Q" (Shift+q) which imply the user to hit two key control could be a solution ?
Thanks for sharing your experience @okalm. I have changed the default so that the q key alone is no longer supported.
Note that you can already change what keys cause Amfora to quit by setting bind_quit
in the [keybindings]
section of your config. You could do something like this for example:
bind_quit = ["Q", "Ctrl-q"]
This would support shift-q and ctrl-q only.
Personally I will modify mine to keep the original behaviour:
bind_quit = ["Ctrl-C", "Ctrl-Q", "q"]
Please consider changing, or adding additional dialog box for the "q" keyboard shortcut. For me is very common that during browsing, with many tabs open I accidentally press "q" and Amfora quits without any warning. I think that "q" is too simple for that command (just leave CTRL + q, like CTRL + w). Or Amfora should warns by "are you sure" dialog.