KMeleonWiki > Resources > MacroLibrary > del.icio.us luamacros

Submitted by: rstlne


Macros for posting a bookmark to del.icio.us, a social bookmarks manager. The title and url are taken from the current page and the form for posting to del.icio.us will open up in a new window or tab or layer.

Hit F12 to post to del.icio.us.
Hit Shift-F12 to set the del.icio.us user name.
F12 will also prompt you for the del.icio.us user name if you haven't previously set one up.

Also accessible from the document popup menu. Accelerator definitions below may be omitted if not needed.

This is a luamacros version of the original del.icio.us macros. The luamacros plugin is required. This plugin can be found in K-MeleonCCF 0.04 Beta3 and later.

The main advantages to using this luamacros version are:

  • Lua code is easier to read and maintain.
  • The code should be able to handle weird characters in the web page title and URL better.

Save as delicious.lua:


-- Lua Macros for bookmarking a page with del.icio.us

    local depref = "kmeleon.general.deliciousUser"

    local function EE(str)
        return encode(EncodeUTF8(str))

    local function GotoNew?(hwnd, url)
        NavigateTo?(url, OPEN_NEW, hwnd)

    function SetDelicious?(hwnd)
        local username = prompt(hwnd, "Set del.icio.us username to: ",
            "del.icio.us setup") or ""
        if username ~= "" then
            setpref(TYPE_STRING, depref, username)
        return username

    local function RunDelicious?(hwnd, username)
        local title, url = GetDocInfo?(hwnd)
        url = url or ""
        if title  nil or title  "" then
            title = url
        GotoNew?(hwnd, "http://del.icio.us/" .. EE(username) .. 
            "?v=3&jump=bookmarks&url=" .. EE(url) .. "&title=" .. EE(title))

    function Delicious(hwnd)
        local username = getpref(TYPE_STRING, depref) or ""
        if username == "" then
            username = SetDelicious?(hwnd)
        if username ~= "" then
            RunDelicious?(hwnd, username)


In macros.lua:

require "copyaslink"
require "google"
require "multiclip"
require "groups"
require "search"
require "search_add"

require "delicious"

In Menus:

%ifplugin luamacros
luamacros(Delicious, Post to del.icio.us)
luamacros(SetDelicious?, Setup del.icio.us user name)

DocumentPopup {
macros(URL, Go to URL)
macros(sendhotkey, Send this page to hotkey)
!View Page



In Accelerators:

# - del.icio.us hotkeys -

%ifplugin luamacros
VK_F12 = luamacros(Delicious)
SHIFT VK_F12 = luamacros(SetDelicious?)

# - End del.icio.us hotkeys -

Comments & Questions


(c) 2000-2010 kmeleonbrowser.org. All rights reserved.
design by splif.