coteditor / CotEditor

Lightweight Plain-Text Editor for macOS
https://coteditor.com
Other
6.49k stars 433 forks source link

Allow Hot Close/Hot Exit (Close App with No "Save ..." Dialogs) #1154

Open MattMicheletti opened 3 years ago

MattMicheletti commented 3 years ago

Hello,

I am wondering if the ability to close the app (with the standard Red close button/light in the upper left corner) and have it just close down without asking for/displaying "Save..." dialogs exists? I've seen this refereed to as hot exiting or hot closing in other apps/what not. Is this a feature or possibility to add to CotEditor? Currently, I have to right click the dock-icon and then select "Quit" (which I assume is exhibiting the correct behavior ... well based on my usage so far ... it is). I was just curious if there was a way to get similar functionality in the standard close button.

Why? Well, the idea is essentially to have CotEditor function similar to Notepad++ (of which it pretty much is the closest thing on macOS): auto-saving files (even unsaved/untitled ones until the user saves them manually) and reopening all previously opened files (incl. unsaved ones) again on the next app start. E.g. really awesome and automagic session management.

Please let me know if there is anything I can provide or help to explain/elaborate.

Please and thanks,

AleXburnA commented 3 years ago

Hi, I would LOVE this feature as well. I recently migrated to MacOS and found a perfect replacement for Notepad++ in CotEditor. The only thing that drives me crazy several times a day is exactly the Save dialog.

Thanks in advance Alex

MattMicheletti commented 3 years ago

Hi, I would LOVE this feature as well. I recently migrated to MacOS and found a perfect replacement for Notepad++ in CotEditor. The only thing that drives me crazy several times a day is exactly the Save dialog.

Thanks in advance Alex

The closest alternative to Notepad++ with this feature is Textastic (and Sublime Text 3 ... sort of). I still use both CotEditor, Textastic, and Sublime Text 3 as my Text Editor toolkit.

1024jp commented 3 years ago

Hi, sorry for my late answer and thank you for the feedback.

CotEditor already has a feature called Auto Save that relies on the macOS's auto save feature. You can turn it on from CotEditor's preferences > General pane > "Enable Auto Save with Versions."

Screen Shot 2021-06-10 at 19 38 49

Doesn't it fulfill your demand? If so, let me know that the different from this feature and your request.

AleXburnA commented 3 years ago

Hi and thank you for your answer!

@MattMicheletti thanks for your input, I will definitely check it out.

@1024jp I am aware about that feature and I use it all the time. The problem is, this works only for existent files on the local machine.

I often have multiple unnamed/unstored files open, which I use as a temporary notepad. Other open files are located on SMB shares, for example, where the native macOS auto-save does not work either.

So unfortunately this feature does not really solve my problem.

What we would like to see is an option where clicking on the red X of the window behaves the same way as pressing Command+Q, i.e. a "freeze" of the current state without "do you want to save this" popups.

Thank you and best regards Alex

MattMicheletti commented 3 years ago

@1024jp Sorry for the late reply. I think @AleXburnA accurately described it. Essentially, for an example case/steps-to-reproduce:

Step 1) Open a fresh instance of CotEditor Step 2) Create a new file (Cmd + N) Step 3) Type something: "Hello World" Step 4) Create another new file Step 5) Type something "Goodbye!" Step 6) Right-Click the Dock icon for CotEditor Step 7) Select "Quit" Step 8) Relaunch CotEditor Step 9) Notice the 2 "Untitled..." files created in Steps 2 & 4 are still there (with contents) Step 10) Close the app via the red button in the upper left corner Step 11) Notice the "Do you want to ..." dialogs (We don't want these ... it should function like in Step 7 ... automatic session management)

I hope this helps explain it a little bit better :)

1024jp commented 3 years ago

Thank you guys for your further explanation. Now I understood your demand. However then, I need to consider whether the requested behavior should be implemented to CotEditor because they are out of the native macOS document-based application's behavior. The current CotEditor's saving behavior is designed to conform with the standard macOS app behavior as much as possible to avoid letting users confused. This is the first principle of CotEditor's design philosophy. And avoiding adding options haphazardly is also one of the principles. So, let me have a time.

tophee commented 2 years ago

@MattMicheletti, I'm totally with you on this issue (I'm also coming from Windows and Notepad++). I think the reason why we find it weird that the app behaves like this is that, in macOS, closing a window doesn't usually close the app (but Cmd + Q does).

I was going to say that even within the macOS logic the CotEditor behaviour isn't quite intuitive, but as I think about it, it actually makes sense: if you close a particular document which you haven't saved, it makes sense for the app to ask you whether you want to save it or not (just assuming that you want to keep it and save it under a an untitled-name seems strange, generally speaking (and on Notepad++ it has led to me accumulating many dozens such documents) and assuming the you don't want to keep it and delete it is obviously not a good idea either). If you close the application, by contrast, it makes sense to save the state of any unsaved windows instead of asking the user where to save each of them (which is the default behaviour on Windows which Notepad++ works around).

@1024jp, having said the above, I think it might still be a good idea to introduce an "allow hot clos" user setting to always skip the save modal when closing a window, don't you think?

cristianminaa commented 2 years ago

@1024jp, just discovered this marvellous tool after desperately looking for an alternative to Notepad++, since I switched from Windows. Congratulations on delivering to a huge audience looking for a substitute!

Is there any chance of you implementing what @tophee suggested? Adding an "allow hot close/hot exit" setting? Would improve the life of plenty of people.

Kerwin1202 commented 2 years ago

Hope this feature can be added, although it's just an option turned off by default

carsonwah commented 2 years ago

Hi I just switched from Windows & Notepad++ and found this tool a great replacement for Notepad++ (since it does not support macOS). The only hesitation for me is that after jotting down some notes, I cannot simply close it and set it aside.

For the use case of anonymous temporary notes (which is my primary use case on CotEditor), it is annoying to ask user to think of a temporary name and find a temporary location every time. In the case of Notepad++, using new 1, new 2, ... without the need to save it, is very convenient and perfect for its use case.

I believe this is the pain point for every user switching from Notepad++, even for existing users who have the same use case of this software as above. Please kindly consider this feature.

Suggestion:

nlvraghavendra commented 2 years ago

Hello,

One more user who loves this editor and needs the hot exit while closing via the x button. Please consider implementing this at least via an option so people can choose to use it if needed. Thank you for all your efforts.

pantuts commented 2 years ago

+1 on this

svrmirac commented 2 years ago

Another +1 on this.

nlvraghavendra commented 2 years ago

Sadly, it looks like the developer doesn't care about this feature anymore. I'm currently using Apple Notes which is the closest to have this feature when it comes to pure note taking. It auto saves the notes and you can simply exit. I still wish CotEditor implements this feature since it is a great editor overall.

ybelonozhkin commented 1 year ago

+1 on this

MohamedSayed9392 commented 1 year ago

+1

skylatian commented 1 year ago

+1, having it as a configurable option would be amazing, it's the only thing stopping me from using CotEditor as my default text editor. Is this on the roadmap at all?

n1justice commented 11 months ago

+1

ponson-thankavel commented 10 months ago

+1 ... This is one feature that prevents me from using CotEditor by default. I am still in search of NotePad++ equivalent in macos.

sup3rgiu commented 2 months ago

+1

nt294 commented 2 months ago

Also hoping for this feature

AlessioDiFazio commented 2 months ago

➕1

RikuKunMS2 commented 1 week ago

I setup better touch tool to do this:

Set up Leftclick Red Window Button trigger with an advanced condition focused_element_details BEGINSWITH "<AXApplication: \"CotEditor\">" AND (NOT (focused_element_details CONTAINS " <AXWindow: \"Find & Replace\">")) then have it run a shell script:

window_count=$(osascript -e 'tell application "System Events" to count (every window of application process "CotEditor")')

if [[ "$window_count" -eq "1" ]]; then
  # Close the active window (more robust than quitting the app if only one window exists)
  osascript -e 'quit application "CotEditor"'
  echo "Active CotEditor quit."
elif [[ "$window_count" -gt "0" ]]; then
  echo "Multiple CotEditor windows are open ($window_count).  Closing now"
  osascript -e 'tell application "CotEditor" to close (window 1)'
else
  echo "No CotEditor windows are open."
fi