K-Meleon

KMeleonWiki > Resources > MacroLibrary > MacroLibrary2 > Toggling toolbars

Submitted by: Marc


This is a macro to initialize toolbars ID's, and use the values to toggle the display.


In Macros:

In OnLoad {} add the line:

$bars ? "":macros(setTB_IDs);

then the code:

$bars=0;


setTB_IDs {
  $bars=2000;
  $ID_URL_bar=$bars; $bars=$bars+1;
  $ID_Thr_bar=$bars; $bars=$bars+1;

  $ID_Layer_bar="";
  getpref(INT,"kmeleon.toolband.Layers.size") !=0 ? $ID_Layer_bar=$bars : $bars=$bars-1;
  $bars=$bars+1;

  $ID_Hotlist_bar="";
  getpref(INT,"kmeleon.toolband.Hotlist.size") !=0 ? $ID_Hotlist_bar=$bars : $bars=$bars-1;
  $bars=$bars+1;

  $ID_Fav_bar="";
  getpref(INT,"kmeleon.toolband.Favorites.size") !=0 ? $ID_Fav_bar=$bars : $bars=$bars-1;
  $bars=$bars+1;

  # these are in fact the first two user defined toolbars
  # default Tool Bar
  $ID_ToolBar="";
  getpref(INT,"kmeleon.toolband.Tool Bar.size") !=0 ? $ID_ToolBar=$bars : $bars=$bars-1;
  $bars=$bars+1;

  # the default "GO button" bar
  $ID_Go_bar="";
  getpref(INT,"kmeleon.toolband.URL Bar buttons.size") !=0 ? $ID_Go_bar=$bars : $bars=$bars-1;
  $bars=$bars+1;

  # User toolbars (in order of appearance in "toolbars.cfg")
  # Insert your own here...

  # as an example, this is my toolbar with the "close layer" button
  $ID_LayBut_bar="";
  getpref(INT,"kmeleon.toolband.Layer Buttons.size") !=0 ? $ID_LayBut_bar=$bars : $bars=$bars-1;

  $bars=$bars+1;

  # Last toolbars
  # (always after user defined bars)
  $ID_Menu_bar=""
  getpref(INT,"kmeleon.toolband.Menu.size") !=0 ? $ID_Menu_bar=$bars : $bars=$bars-1;
  $bars=$bars+1;

  $ID_Bookmarks_bar=""
  getpref(INT,"kmeleon.toolband.Bookmarks.size") !=0 ? $ID_Bookmarks_bar=$bars : $bars=$bars-1;
  $bars=$bars+1;
}

Now, if you want to toggle the layers toolbar:

Example:

In Accelerators:

CTRL ALT L = macros(hide_layer_bar)

In Macros:

hide_layer_bar{
  id($ID_Layer_bar);
}

hide_laybut_bar{
  id($ID_Laybut_bar);
}

# or to hide both buttons :
hide_layer_bar{
  id($ID_Layer_bar);
  id($ID_Laybut_bar);
}


Comments & Questions

K-Meleon

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