Created
February 7, 2021 18:41
-
-
Save Dima-369/41e5c89a77e2f489ab0359dc8263d18e to your computer and use it in GitHub Desktop.
Take a screenshot of the current window, save to /Desktop and open Finder in Hammerspoon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- using real hyper with shift breaks some hotkeys for whatever reason | |
hyper = {"cmd", "alt", "ctrl"} | |
-- Take a screenshot of the current window | |
hs.hotkey.bind(hyper, "d", function() | |
file_name = "screenshot-" .. os.time() .. ".png" | |
hs.window.focusedWindow():snapshot():saveToFile(os.getenv("HOME") .. "/Desktop/" .. file_name) | |
title = hs.window.focusedWindow():title() | |
hs.alert.show(title .. "\n\n Saved screenshot as " .. file_name) | |
hs.execute('open ~/Desktop/') | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment