Close obsidian window with cmd w on mac. Leave app running for faster launch

On mac, cmd-w typically closes the window when there are no more tabs in a window (e.g., google chrome behaves like this). It would be nice to have this be the hotkey for obsidian too.

Right now cmd w doesn’t do anything after you’ve closed all the panes.

EDIT: To be clear I want cmd-w to close the window of Obsidian. I don’t want it to close the entire app. On macs, you close the window but the app is still running. This makes launch faster.

21 Likes

But when there are still tabs open Cmd-W closes a tab, which is normal behaviour on other apps too.

To close an app on Mac you can do Cmd-Q, which works on all apps, also on Obsidian.

Therefore, like on Chrome, in Obs I have set Cmd-W to close a pane.

1 Like

If I wanted to close Obsidian entirely, I’d Cmd+Q.

That said, Cmd+W (with no open panes) would be great for closing the vault, especially when you have more than one open.

5 Likes

Obsidian does not behave like chrome right now.

Chrome with 2 tabs open:

  1. hit cmd-w, tab closes. one tab left.
  2. hit cmd-w, window closes.

Obsidian with 2 panes open:

  1. hit cmd-w, pane closes. one pane left.
  2. hit cmd-w. nothing happens

Note for chrome, when you close the last tab, chrome is actually still running in the background and you have to hit cmd-q to quit the app, yes.

Almost all other apps operate this way where both cmd w closes the last window or tab and leaves the app running in the background. For example, nvalt, the archive, spotify, textedit, outlook, vscode, preview, etc.

It’s a matter of muscle memory.

1 Like

I did NOT say Obsidian behaves like Chrome.

I stated that, as with other apps, incl. Chrome, Obs can be closed with Cmd+Q. You can close Chrome that way, and Obs also.

Cmd+W is not a shortcut to close apps, Cmd+Q is, so you already have a shortcut to close Obs.

@3mbry0’s suggestion to have Cmd+W close a vault if there are no open panes is a more sensible use of Cmd+W.

1 Like

Ah, I get your point - you’re saying that Obsidian is a subset of Chrome’s behavior (in terms of tabs / panes closing).

I think @3mbry0’s suggestion would effectively be the same as my suggestion though, wouldn’t it? Unless you add special logic to not close the last vault…

I don’t want cmd-w to close the app, I just want it to close the window but leave it running as a background process.

Obsidian takes a little bit to load, it would be nice to have it be faster when launched with a hotkey (hence leaving it running it background).

A subset of Chrome’s behaviour? Errr, no. I mentioned Chrome as an example, but that does not imply Obs being a subset.

I don’t want cmd-w to close the app, I just want it to close the window but leave it running as a background process.

OK, understood.

Besides faster launching, there’s another reason this feature matters: when Obsidian is not running in the background, launching an Obsidian URL will not take you to the corresponding note. I think there was a discussion in discord about this behavior and turns out it’s a limitation of Electron.

I’d like to leave Obsidian running 24/7 on my Mac because the URL scheme doesn’t work properly otherwise.

2 Likes

when Obsidian is not running in the background, launching an Obsidian URL will not take you to the corresponding note

This. I have a hacky workaround in my Alfred script that checks first if Obsidian is running, and if not, launch it, wait a little bit and then fire the URL scheme. Ugly but it works.

I guess this bug is in the underlying Electron framework itself? Hope somehow they figure out a workaround or an upstream fix. URL schemes are key to my workflow.

Not quitting the app when the windows are closed would be great “for now”.

Seconded, this would be a good usability addition.

I would like to add that in addition to the “close pane” and “close other panes”, a “close all panes” functionality would be quite handy when dealing with multiple vaults – mapping this to ⇧⌘W (Mac standard for this functionality) would remove the need to reach for the mouse to close the vault window.

(I have a custom shortcut defined for this so not very urgent, but it would of course be preferable if this were supported in the app.)

I was about to make the same feature request. Lacking this just feels like a UX bug.

1 Like

I came here to make this same request. Pressing Cmd+W should close panes, until there are no panes, at which point it should close the window.

Particularly with Sync being a thing, there are good reasons to leave the app running with the windows closed, and I’d just as soon be able to do that without using a mouse. Thanks!

2 Likes

Is anyone able to close an Obsidian window without touching mouse on Mac?

Example:
I have 2 Obsidian windows open. I can toggle between them using cmd - ~. However, I cannot close one window without having to CLICK the red x button using mouse/trackpad. i.e. I cannot do a simple cmd - w. cmd - w only closes tabs… This is a real bottleneck for my productivity, I’m wondering how everyone else is dealing with this problem. Is there a hack?

This seems like an Electron app issue. Could the devs take a look at this @Licat :

It would be awesome if you could add a Command - W option in the Menu to close the window. Or, to be independent from the current Command - W which closes tabs, could use Command + Shift - W instead?

3 Likes

You can almost get the intended behaviour by using ⌘-H (Hide) instead of ⌘-W (Close) when you’re looking at the “No file is open” screen. But it’s a bit of a nuisance to remember to use that shortcut for just this single app, so i agree that it would be nice if Obsidian would act the same as other macOS apps. E.g. Franz is also an Electron app and there ⌘-W works as expected.

+1 on closing the window w/ cmd+w.

cmd+Q is too permanent - takes time for the restart etc (mentioned above).
I personally don’t use cmd+h because of the worry that it might hoard memory (?)

PS. Not entirely sure why browsers are (nearly) all caught up with the confirmation-to-quit thingy (double pressing cmd+q). Sure, mistakes/accidents can happen, but that’s what the re-open all page/tab function is for, I think. :confused:

Now that you mention it, I realized that Visual Studio Code works as expected as well.

I don’t think there’s any difference between ⌘-W and ⌘-H memory wise. In both cases the app is still running but not showing any windows. To make sure the app is not consuming any memory you need to fully quit it.

Activity Monitor shows Obsidian takes (about) 80–100MB with no windows, and each window spawns a new “Obsidian (Renderer)” instance, itself about 80MB. ⌘-H doesn’t affect this (the window is hidden) but the red cross does (the window is closed, and takes a moment to re-open). A working ⌘-(shift-)W key would definitely help there.

In terms of this suggestion, however, I’m more bothered by how unwieldy it is to manage having multiple vaults open. There’s not even an option in the menu bar to close a window, so a sysprefs shortcut can’t even help. It kinda hampers the native-app experience when this basic hotkey is nowhere to be found :confused:

1 Like

There is a menu item under the File menu that closes the window.
If you use a macro or automation tool on your mac you can create a neat work around. For example I use Keyboard Maestro, and when I now press cmd W it will hit that menu item. You can do the same from the keyboard settings in your mac.
Just make sure you update the hotkey inside obsidian for closing a pane to something like cmd shift W

1 Like