You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the hammerspoon abilities I love most is the ability to use it to access passwords and generic info in KeyChain:
function extractPassword(type, service)
local cmd = "security " .. type .. " -s " .. service .. " -a " .. os.getenv("USER") .. " -w"
local str_p, status = hs.execute(cmd)
str_p = string.gsub(str_p, "\n", "")
return str_p
end
used like:
hs.hotkey.bind({"cmd", "alt"}, "S", nil, function()
-- CLI: security add-generic-password -a ${USER} -s "ssh passphrase" -w
local str_p = extractPassword("find-generic-password", "'ssh passphrase'")
str_p = string.gsub(str_p, "\n", "") -- trim newline
hs.eventtap.keyStrokes(str_p)
end)
or
hs.hotkey.bind({"cmd", "alt"}, "P", nil, function()
-- CLI: security add-internet-password -a ${USER} -s $(hostname) -w
local str_p = extractPassword("find-internet-password", hs.host.localizedName())
str_p = string.gsub(str_p, "\n", "") -- trim newline
hs.eventtap.keyStrokes(str_p)
end)
the latter is golden for the countless times I get asked each day for my password on work web sites.
Thanks for all the work you put into Hammerspoon - it makes my Mac life far nicer!
The text was updated successfully, but these errors were encountered:
You might not want your unsplash client id exposed for the world
https://github.com/cmsj/hammerspoon-config/blob/master/init.lua#L507
One of the hammerspoon abilities I love most is the ability to use it to access passwords and generic info in KeyChain:
function extractPassword(type, service)
local cmd = "security " .. type .. " -s " .. service .. " -a " .. os.getenv("USER") .. " -w"
local str_p, status = hs.execute(cmd)
str_p = string.gsub(str_p, "\n", "")
return str_p
end
used like:
hs.hotkey.bind({"cmd", "alt"}, "S", nil, function()
-- CLI: security add-generic-password -a ${USER} -s "ssh passphrase" -w
local str_p = extractPassword("find-generic-password", "'ssh passphrase'")
str_p = string.gsub(str_p, "\n", "") -- trim newline
hs.eventtap.keyStrokes(str_p)
end)
or${USER} -s $ (hostname) -w
hs.hotkey.bind({"cmd", "alt"}, "P", nil, function()
-- CLI: security add-internet-password -a
local str_p = extractPassword("find-internet-password", hs.host.localizedName())
str_p = string.gsub(str_p, "\n", "") -- trim newline
hs.eventtap.keyStrokes(str_p)
end)
the latter is golden for the countless times I get asked each day for my password on work web sites.
Thanks for all the work you put into Hammerspoon - it makes my Mac life far nicer!
The text was updated successfully, but these errors were encountered: