4 ms·
Love Hammerspoon, I have a small snippet to store bookmarks. I copy the url, open the shortcut, add tags and it is saved to sql lite file. local function ins
by p2hari 5y ago
Love Hammerspoon, I have a small snippet to store bookmarks. I copy the url, open the shortcut, add tags and it is saved to sql lite file.
local function insertDB(db, linkval, value)
local url = tostring(linkVal)
local categ = tostring(value)
db:exec[=[
INSERT INTO bookmarks VALUES (NULL,`url`,`categ`)
]=]
end
hs.hotkey.bind({"alt", "ctrl"}, "S", function()
db = hs.sqlite3.open('/dropbox/user/bookmarks.db')
local insert_stmt = assert( db:prepare("INSERT INTO
bookmarks VALUES (NULL, ?, ?)") )
local url = hs.pasteboard.getContents()
local tag, value = hs.dialog.textPrompt(url, "Please enter
category:");
if tag == 'OK' then
insert_stmt:bind_values(url, value)
insert_stmt:step()
insert_stmt:reset()
-- insertDB(db, linkVal, value)
end
end)