Select the section of the screen you want to capture. To capture a specific window, use Command + Shift + 5 (yes, the same shortcut to trigger the screenshot tool). Then hit the space bar to switch between capturing a section of screen and a specific window.