Awesome: renamed tags with unicode symbols.

Luakit: added a bookmark converter script.
master
Ambrevar 2012-09-27 17:56:08 +02:00
parent 538740b820
commit 4e86202c5d
2 changed files with 54 additions and 1 deletions

View File

@ -86,7 +86,8 @@ tags = {}
for s = 1, screen.count() do
-- Each screen has its own tag table.
-- tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1])
tags[s] = awful.tag({ " 1 ", " 2 "," 3 "," 4 ", " 5. Factory ", " 6. Music ", "7. Mail " }, s, layouts[1])
-- tags[s] = awful.tag({ " 1 ", " 2 "," 3 "," 4 ", " 5. Factory ", " 6. Music ", "7. Mail " }, s, layouts[1])
tags[s] = awful.tag({ " 1 ", " 2 "," 3 "," 4 ", " 5 ⚒ ", " 6 ♫ ", "7 ✉ " }, s, layouts[1])
end
-- }}}

52
.luakit_bookmarks_converter.lua Executable file
View File

@ -0,0 +1,52 @@
local usage = [[Usage: luakit -c bookmark_migrate.lua [old bookmark db path] [new bookmark db path]
]]
local old_db_path, new_db_path = unpack(uris)
if not old_db_path or not new_db_path then
io.stdout:write(usage)
luakit.quit(1)
end
-- One-pass file read into 'data' var.
old_db = assert(io.open(old_db_path, "r"))
local data = old_db:read("*all")
assert(old_db:close())
-- Init new_db, otherwise sqlite queries will fail.
new_db = sqlite3{ filename = new_db_path }
new_db:exec("CREATE TABLE IF NOT EXISTS bookmarks (id INTEGER PRIMARY KEY, uri TEXT NOT NULL, title TEXT NOT NULL, desc TEXT NOT NULL, tags TEXT NOT NULL, created INTEGER, modified INTEGER )")
-- Fill
local url,tag
for line in data:gmatch("[^\n]*\n?") do
if string.len(line) > 1 then
print ("["..line.."]")
-- Get url and tag (if present) from first line.
_, _, url, tag = string.find(line, "([^\n\t]+)\t*([^\n]*)\n?")
-- Optional yet convenient output.
io.write(url)
io.write("\t")
io.write(tag)
io.write("\n")
-- DB insertion. Nothing will be overwritten. If URL and/or tag already exists, then a double is created.
new_db:exec("INSERT INTO bookmarks VALUES (NULL, ?, ?, ?, ?, ?, ?)",
{
url, "", "", tag or "",
os.time(), os.time()
})
end
end
print("Import finished.")
print("\nVacuuming database...")
new_db:exec "VACUUM"
print("Vacuum done.")
luakit.quit(0)