Skip to content

Instantly share code, notes, and snippets.

@psifertex
Last active October 8, 2019 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psifertex/aad97d009e6f21d3380d49fc36331ab5 to your computer and use it in GitHub Desktop.
Save psifertex/aad97d009e6f21d3380d49fc36331ab5 to your computer and use it in GitHub Desktop.
hs.hotkey.bind({"cmd", "alt", "ctrl", "shift"}, "4", function()
local timeStamp = string.gsub(os.date("%Y-%m-%d_%T"), ":", ".")
local fileName = os.getenv("HOME") .. "/Desktop/ss-" .. timeStamp .. ".png"
local windowId = hs.window.frontmostWindow():id()
hs.task.new("/usr/sbin/screencapture", nil, {"-l" .. windowId, fileName }):start()
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment