Add option to close Kate when last file closes
ClosedPublic

Authored by thsurrel on Oct 12 2018, 9:10 PM.

Details

Summary

This is a proposal for Kate following the discussion in D15278.

Test Plan

Open one file in Kate.
In Settings > General options, enable the new option "Close Kate entirely when the last file is closed"
Close the file by any mean (tab button, Ctrl-W, ...)
Kate should shutdown.

Diff Detail

Repository
R40 Kate
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
thsurrel created this revision.Oct 12 2018, 9:10 PM
Restricted Application added a project: Kate. · View Herald TranscriptOct 12 2018, 9:10 PM
Restricted Application added a subscriber: kwrite-devel. · View Herald Transcript
thsurrel requested review of this revision.Oct 12 2018, 9:10 PM

+1 for implementing the feature.

However, I'm always a bit wary about adding new off-by-default options. Making something optional in the first place is an a certain lack of confidence in the feature; having it off by default magnifies that. If this should really be both optional and off by default, should it really be done at all? My vote would be for turning it on by default, but I think ideally, this would be a global setting somewhere in System Settings (maybe the same place we'd put the options requested in https://bugs.kde.org/show_bug.cgi?id=376992) and would affect all KDE apps with tabs.

+1 for implementing the feature.

However, I'm always a bit wary about adding new off-by-default options. Making something optional in the first place is an a certain lack of confidence in the feature; having it off by default magnifies that. If this should really be both optional and off by default, should it really be done at all? My vote would be for turning it on by default, but I think ideally, this would be a global setting somewhere in System Settings (maybe the same place we'd put the options requested in https://bugs.kde.org/show_bug.cgi?id=376992) and would affect all KDE apps with tabs.

Please please please implement this, it will boost my productivity.

My use case: if I close a session with alt+f4, the next time I open it it will have the same files which sometimes is not desired if there is too much clutter (let's say, 20 log files that I don't need anymore). So I hold down ctrl + w to close all, and then have to reach out to alt+f4, which not only is annoying but leaves far away from alt+tab. This feature would be sweet (I even made my first account just to vote on this, lol).

I think it should be on by default. It's hard for me to imagine that someone closing his last document will want to start working on a new empty file.
Another reason: it would be consistent with how popular tabbed software works: in both firefox and chrome when I close the last tab, the window is closed, I don't get a new welcome tab. "Simple by default powerful when needed" I think familiarity is related to simplicity to an extent...

The use-case for keeping Kate open is e.g. if you have projects in the projects plugin open, then it is not that uncommon to just close all files and still wanting to have Kate stay open.
Thought, as one can enable that behavior again, I am not that against making "close on last view closed" the default.
Other opinions?

aacid added a subscriber: aacid.Oct 13 2018, 3:38 PM

*personally* I'd hate it to be the default, since clearing all the open files to get an empty one where i can write is something i do several times a day.

Also it doesn't seem to be the behaviuour of any text editor i know, so i'd play it safe

pino added a subscriber: pino.Oct 13 2018, 5:01 PM

*personally* I'd hate it to be the default, since clearing all the open files to get an empty one where i can write is something i do several times a day.

This. Or simply you have a single file in kate, you do not need it anymore but still want to edit more files in the same directory/project.

My use case: if I close a session with alt+f4, the next time I open it it will have the same files

There is already the option in kate for the session behaviour on startup (see settings -> configure kate -> sessions): start a new session, load the last used session, manully choose a session.
So your use case is already covered.

*personally* I'd hate it to be the default, since clearing all the open files to get an empty one where i can write is something i do several times a day.

+1

My use case: if I close a session with alt+f4, the next time I open it it will have the same files

There is already the option in kate for the session behaviour on startup (see settings -> configure kate -> sessions): start a new session, load the last used session, manully choose a session.
So your use case is already covered.

I have a script that opens files recursively on a directory and fires a session with the name of that directory, so a brand new session is not the same. I realize my scenario is a 1% thing.

Also it doesn't seem to be the behaviuour of any text editor i know, so i'd play it safe

I did not notice this. Replicating other editors' default may be a better idea than replicating chrome's default.

I don't really care about the default, I dig deep in the config anyways ^_^

cullmann accepted this revision.Oct 14 2018, 10:08 AM

Then I would say we accept this as is, default off.

This revision is now accepted and ready to land.Oct 14 2018, 10:08 AM

Sorry, another option came to me: we could keep the behavior of Kate that opens a blank page when closing the last opened file, but then shutdown Kate completely if that blank page itself is closed.
No need for a new option with this solution, but maybe more Kate-specific, in the sense that it will generalize less easily if we have a system-wide setting about that one day, as Nate descirbed.

I think that is very confusing ;=)
I can understand the logic behind: all views close => application close
But I don't really think that: all views close => empty document => that view close => application close is really something that is very understandable

This revision was automatically updated to reflect the committed changes.