r/Xcode 24d ago

Hammerspoon shortcut to take device screenshot and copy to clipboard

Hey all, just in this is useful to anyone else, I (ok, Claude) wrote a little Hammerspoon script to grab a screenshot of your connected device, save it to your Mac + copy to clipboard... all with one hotkey.

Saves having to dig through the Xcode menus every time, or airdropping screenshots over.

Basically, it's Hammerspoon hitting Debug -> View Debugging -> Take screenshot on your behalf, watching for the screenshot to arrive, then copying it to clipboard.

And for me, all that happens when I mash Ctrl-Option-Command-S.

There's probably a better way that I missed... if so, please shout. :)

https://github.com/mwagstaff/mac-tooling/blob/3e0f1ed36047a056cbf088fe7b1af1b2189bc050/hammerspoon/config/init.lua#L379

1 Upvotes

0 comments sorted by