6

I am looking for a way to close the currently focused window using a keyboard shortcut. Effectively I want to do the same thing as the red "X" button in the top left corner, only using a keyboard. On windows/linux this is done by alt+f4

I know about:

  • ⌘ Cmd+w - in any tabbed application such as google chrome it will close the current tab instead of current window
  • ⌘ Cmd+q - will close the entire app instead of just the current window
  • Years later, and mac still lacks a universal way to close windows using the keyboard :/ – Dev Aggarwal Mar 28 at 19:46
6

Shift+⌘ Cmd+w does what you want in Safari and Chrome. I don't think it's a system-wide standard, though.

Update: It works in Finder too so maybe it is a standard.

  • 1
    cmd/shift/w is a pretty much the global command for 'close all windows'. As most apps on Mac won't quit when the last window is closed, I guess this is as close as you will get, but it is not the equivalent of alt/F4, as that will quit the frontmost process. On Windows, having two windows open means you have two running processes, on Mac it doesn't. – Tetsujin Sep 15 '15 at 19:03
2

I think it's more like ⌘ Cmd+Q.

Or you can open a terminal and killall MyApplication

  • problem with this is that it closes ALL the application's windows (tested in Chrome) – dragonmnl Feb 1 '18 at 14:45
1

I believe that ⌘ Cmd+w IS what you are looking for. It doesn't just work for tabbed applications, such as browsers. I tested it in Finder this morning, the OS X Mail App, as well as Microsoft Word and Excel. All of those support using the ⌘ Cmd+w combination to close the current window.

1

BetterTouchTool (http://www.bettertouchtool.net) lets you assign many actions to trackpad and magic mouse gestures / mouse buttons / keyboard shortcuts. The "Close Window below cursor" action might be close to what you want

  • I am hesitant about installing apps outside of app store (aside of big players such as google chrome), I simply do not trust most authors – siergiej Sep 15 '15 at 19:46
  • 2
    Well, I (kinda) understand that. The developer (Andreas Hegenberg, blog.boastr.net) has been developing BetterTouchTool, among other tools (some of which are also released on the app store), for more than 4 (?) years. It has been reviewed by many journalists (for example on Macworld macworld.com/article/1157058/trackpadtricks.html) and is widely used by Mac users. BetterTouchTool is, in my opinion, a Macbook's killer "app". Many great applications (not apps, applications) only exist outside the app store. Being careful about what you install and from where is important, but don't miss out! – Brethil Sep 15 '15 at 22:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .