Quickly take a screenshot of only the current window on macOS

A macOS shortcut to instantly copy a screenshot of the current app's frontmost window (instead of the entire screen) to the clipboard. No need to bother with the official way by pressing shift-command-4, then spacebar, then after the pointer has turned into a camera symbol, clicking the window you want the screenshot of.

To assign a keyboard shortcut to it, open the shortcut in Shortcuts app, click ⓘ in the sidebar, then the Add Keyboard Shortcut button, then press your keyboard combination.

You have to wait some time for the keyboard shortcut to be activated systemwide (less than a minute), but if you restart the app you want the screenshot of, it will work immediately.

Download shortcut