I’ve created Screenshot.alfredworkflow which does all this, so simply download it and install it into your Alfred and you’re good to go! This workflow includes the quickgrab binary, so you don’t need to get it separately. I also set up a hotkey for cmd+§ (finally a use for that § key!) which does the same thing. This then creates a PNG file with a name similar to Screenshot-20160724-1124429.png on my desktop. To use, I ensure that I have the window I want to capture active and then activate Alfred, type screenshot and press return. $ sleep 2 quickgrab -file ~/Desktop/Screenshot-`date '+%Y%m%d-%H%M%S'`.pngĪlfred is little app that can run commands for you from a text window or via a hotkey, so this is what I use to trigger QuickGrab. When I investigated, I discovered that it’s because Chrome creates an invisible window at the top of its stack which needs to be ignored when looking for the active window. A friend recently discovered that the current master version fails to take screenshots of Chrome if it’s the active window. You’ll see a small window with a white background open on your desktop. To open it, either open your Applications folder, then open Utilities and double-click on Terminal, or press Command-space to launch Spotlight and type 'Terminal,' then double-click the search result. (The binary quickgrab is in the repo, so you don’t have to compile)Īs an aside, that link is to my fork which fixes Chrome. The Terminal app is in the Utilities folder in Applications. QuickGrabįortunately, there’s a little open source utility called QuickGrab which solves this. There’s a built-in command line utility called screencapture which requires you to know the Quartz window id of the window you want to capture, so it’s now a multi-step process to just take a screenshot of the currently active window. The built-in way to do this on a Mac is to use shift+cmd+4, then press space and then use your mouse to highlight the window and click.įor a good proportion of the time, I’m not using a mouse, so this doesn’t work great. And, in case you want to stop a command you've input, you can do that by tapping the window (if it isn't already selected) and holding down the "control" key and hitting "c." Or, if you want to repeat a command, simply use the up arrow key to cycle through previously used commands and, when you see the one you want, press "return."ĭon't worry if you make a mistake in your command pathways: You'll just get a message back saying something along the lines of, "No such file or directory exists.I find myself needing to take screen captures of the currently active window in OS X reasonably frequently. If you need to get to your Terminal's settings, hold down the command key while tapping the comma button. Note that the file pathway is also fundamental here.
Open -a "APP NAME" Open a text-based file using the text editor: Open Open a file using an application you specify:Īgain, you'll need the file pathway to use this command. In either case, hit the spacebar following the app name and then the command would take hold.
Even though the latter appears to only copy the actual file name, it actually captures the full pathway. To do so, you can either drag the file to the Terminal window to add to the line, or right click the file and select "Copy " and then use the Command+V shortcut to paste it into the Terminal. Open -a "APPLICATION NAME" Open a file using the default application:įor this, you'll have to know the command pathway for the file you want to access.
Or, if the application has a space in its name: If you input this exact phrasing, Terminal will open your Spotify app.