popscallion4k downloadsClose the window with cmd+W on macOS when the last tab is closed.
This plugin provides an alternative to the "Close current tab" command in Obsidian ("workspace:close") for users who prefer more browser-like behavior where closing the last open tab closes the window but leaves the app running in the background for quicker relaunch.
"Close current tab or empty window" closes the currently focused tab unless it is pinned, in which case it either unpins the tab or closes it directly (toggleable via plugin settings). If tabs are open in multiple tab groups/popouts, the plugin will cycle through all open tabs until only one remains in the main window.
To use this command, either invoke it from the Command Palette or map it to the Close current tab hotkey (cmd+W on MacOS by default). The plugin does not take over cmd+W by itself: remove the hotkey from "Close current tab" and assign it to "No Empty Windows: Close current tab or empty window".
With the default settings the last tab closes to an empty tab first, and the window closes when that empty tab is closed. Turn off "Allow empty tabs" to close the window right away.
The close button on the last tab (and a middle click on it) closes the window in the same cases. Pinned tabs are left to Obsidian, and a double click never closes the window. This can be turned off in the plugin settings. Closing a tab from its right-click menu is not covered.
Tabs in the sidebars do not count as open tabs.
Look for this plugin under Community Plugins in the Obsidian settings, or unzip into [vault]/.obsidian/plugins/.