K-Meleon

KMeleonWiki > Resources > MacroLibrary > MacroLibrary2 > Load a URL in a New Layer
Submitted by: WHO - junkeymail»mindless (that is a real address) w/assistance from Marc


Note: this macro requires the deprecated layers Kplugin for pseudo-tabs; layers are deprecated. The latest official versions of K-Meleon and all active development natively support true tabs.



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.


In Macros:

# Macro to load a URL in a new layer

new_layer_load {
 $oldclip = getclipboard()
 id(ID_SELECT_URL); id(ID_EDIT_COPY);
 $address = getclipboard(); setclipboard($URL);
 id(ID_SELECT_URL); id(ID_EDIT_PASTE);
 pluginmsg(layers, "OpenURL", $address);
 setclipboard($oldclip);
}


In Accelerators:

under "%ifplugin macros" add

SHIFT VK_RETURN = macros(new_layer_load)


In Toolbars:

(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
 }
}


User Comments:

By jsnj & Marc:

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.

In Macros:

Copy the text highlighted in gray.

$loaded = "";

URLInNew{
$old = getclipboard(); id(ID_SELECT_URL); id(ID_EDIT_COPY);
$add = getclipboard(); setclipboard($URL); id(ID_SELECT_URL);
id(ID_EDIT_PASTE); setclipboard($add);
pluginmsg(layers, "OpenURL","about:blank"); $loaded="go";
}
go{
id(ID_EDIT_PASTE); id(ID_NAV_GO); $loaded=""; setclipboard($old);
}

And within the OnLoad macro in the # EVENT MACROS section, copy the highlighted text:

OnLoad {
  $URL=""; $URL == "about:blank" ? id(ID_SELECT_URL) : "";
  &buttonSync;
  $loaded == "" ? 0 : macros($loaded);
}

In Accelerators:

Any valid keyboard shortcut you desire

ALT N = macros(~URLInNew)
K-Meleon

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