I find myself hitting Cmd + Q often instead of other shortcuts. This immediately closed the Obsidian app on the mac. This completely throws you off.
Proposed solution
It would be great if we could do what google chrome does and confirm before actually quitting the app.
Current workaround (optional)
The only solution that i can find would be to remap the Cmd+Q shortcut to something else so it doesnt work but then you need to start using the mouse in other cases where i use the shortcut.
Just forget the quit command completely and press instead minimize cmd+m to clean up your screen.
By the way, Mac has a feature called app nap this reduces application resources if apps are not visible on screen and running idle.
Basically mac covers you needs in this case, users often just donât know all features of their systems and software and look for capricious, individual solutions and plugins when there isnât any need for it.
We DONâT want to quit the app. But sometimes we press cmd+Q ACCIDENTALLY, for example, when trying to press cmd+W to close the current tab. The purpose of feature request is to avoid this kind of accident.
@ush could you simply map Cmd+Q to be minimize? Then youâll never quit by accident.
When you want to manually quit, you can use the âClose windowâ command from the command palette.
Thatâs what Iâve done at my end. I also remove the close button via CSS so that i canât accidentally close by clicking it. @afterobs FYI you can remove that X close button.
(If you wanted to get really advanced, you could make a Quick Actions script to add the âDo you really want to quit?â prompt, and then assign that to Cmd+Q.)
Ok i finally found a solution to do this using Hammersppon. You have to install hammerspoon and use the following config and it works like a charm! This also works across the mac so that is a great solution too!
-- Variables to keep track of the quit timer and the application
local quitTimer = nil
local quitApp = nil
-- Bind the Command+Q hotkey
hs.hotkey.bind({"cmd"}, "q", function()
-- Get the currently active application
local currentApp = hs.application.frontmostApplication()
-- Check if there's an existing timer and if it's for the same app
if quitTimer and quitApp == currentApp then
-- If it's the second press within the time window, quit the app
currentApp:kill()
-- Stop and clear the timer
quitTimer:stop()
quitTimer = nil
quitApp = nil
-- Show an alert that the app has been quit
-- hs.alert.show(currentApp:name() .. " has been closed.", 1)
else
-- If there's an existing timer for a different app, stop it
if quitTimer then
quitTimer:stop()
end
-- Store the current app and start a new timer
quitApp = currentApp
quitTimer = hs.timer.doAfter(0.5, function()
-- This function runs if the timer expires (0.5 seconds pass)
-- Reset the timer and app variables
quitTimer = nil
quitApp = nil
end)
-- Show an alert to press again to quit
hs.alert.show("Press Command+Q again to quit " .. currentApp:name(), 0.5)
end
end)