K-Meleon
KMeleonWiki > Resources > MacroLibrary > Load a URL in a New Layer
Submitted by: WHO - junkeymail»mindless (that is a real address)
Notes:
This Macro allows you to load a URL that has been typed in the URLbar in a new layer, preserving the current page in it's current layer. It is not necessary to add the info to both Toolbars.cfg and Accelerators.cfg. This isn't perfect - it doesn't re-instate the URL of the page you originally had(that stays in the original layer). Anyone that can add that please do.
# Macro to load a URL in a new layer new_layer_load { $oldclip = getclipboard() id(ID_SELECT_URL?); id(ID_EDIT_COPY?); $address = getclipboard(); pluginmsg(layers, "OpenURL", $address); setclipboard($oldclip); } # note added by Marc, # see modification to this macro, in comment below
under "%ifplugin macros" add
SHIFT VK_RETURN = macros(new_layer_load)
(you may want to add everything between the first and last line into the 'URL Bar buttons' toolbar to keep things tidy)
Go in Layer Toolbar { Go in New Layer{ macros(new_layer_load) Open in New Layer (Shift+Enter) #you can use any icon layers.bmp layers.bmp layers.bmp } }
Comment by jsnj:
The above macro will only search for & process valid URL addresses in a new layer. The macro below also recognizes Bookmark Nicknames, Folder Groups, & Quicksearches along with URL addresses.
$loaded = ""; URLInNew?{ $oldclip = getclipboard() id(ID_SELECT_URL?); id(ID_EDIT_COPY?); pluginmsg(layers, "OpenURL","about:blank"); $loaded="go"; } go{ id(ID_SELECT_URL?);id(ID_EDIT_PASTE?); id(ID_NAV_GO?);$loaded=""; setclipboard($oldclip); } # comment added by Marc, (jsnj has also modified his "OnLoad?" macro) # in "OnLoad?" add the following line (if not present) $loaded == "" ? 0 : macros($loaded); # see also modification in comment below # It allows the correct URL to be displayed in the URL bar.
Any valid keyboard shortcut you desire
ALT N = macros(URLInNew?)
Comment by Marc:
In the original macro "new_layer_load" insert the following lines. This ensures that the correct url is displayed in the "mother" layer.
## old code (insert after) $address = getclipboard(); # new code setclipboard($URL); id(ID_SELECT_URL?); id(ID_EDIT_PASTE?); ## old code (insert before) pluginmsg(layers, "OpenURL", $address);
In the macro from jsnj, the modification is as follows.
## old code (insert after) id(ID_SELECT_URL?); id(ID_EDIT_COPY?); # new code $address = getclipboard(); setclipboard($URL); id(ID_SELECT_URL?); id(ID_EDIT_PASTE?); setclipboard($address); ## old code (insert before) pluginmsg(layers, "OpenURL","about:blank");