Make it possible to close vault

Use case or problem

I work with more than one vault and I would like to be able to quickly close vaults with a keyboard shortcut to keep my desktop uncluttered and focus better. There is a keyboard shortcut for “Open another vault”, but not for “Close this vault”, which is unexpected (asymmetry).

Proposed solution

Add a shortcut to “Close existing vault”.

Current workaround (optional)

I have to move my hands away from they keyboard and use the mouse to close vaults.

8 Likes

I use a custom BetterTouchTool (on a Mac) for that – the standard ⇧⌘W key closes the vault window. But I agree that it would be better to have option exist natively.

1 Like

How did you configure BetterTouchTool to close the vault window? I’m not familiar with that tool but I ask in case I can find a similar workaround.

@juan I’m using Keyboard Maestro to map ⇧⌘W to close the vault window. If you’re familiar with Keyboard Maestro, it’s easy to do. Just set the hot key you want and use the “Move or Click Mouse” action like this:

close-vault-window

1 Like

I addressed this by using the following Hammerspoon snippet:

hs.hotkey.bind({"cmd", "shift"}, "W", function()
  local win = hs.window.focusedWindow()
  win:close()
end)

Note this binding will close any focused window, not just for Obsidian.
In any case, hope it helps someone out there.

P.S. It’s kind of surprising that, AFAIK, there’s still no official solution for this. Or is there? :thinking:

1 Like

Hey, I love Hammerspoon and use it for all sorts of stuff! But in MacOS, you can bind a hotkey directly in the Keyboard preferences to the menu item, “Close Window”.

In Windows, you can just hit alt-F4, the standard hotkey to close an app. It closes the current vault, and not all open vaults.

(Not to say a built-in command wouldn’t be great.)

I’ve been using OSX for almost 10 years now and didn’t know about this feature! So cool.
Already deprecated the Hammerspoon snippet in favor of this solution.
While there is no official binding, this is the correct workaround in OSX, IMHO.
Thanks for sharing :slight_smile: