(_HowTo_ modify menus in menus.cfg or using macros)
Quote
cpm1a_new
and this one crashes KM :-(
where am i wrong?
------------
KM_ToggleAdblock{
macroinfo=_("Toggle Adblock");
macros("KM_ToggleAdblock");
}
_KM_ToggleAdblock_BuildMenu{
setmenu("Nav",macro,"Author/User","KM_ToggleAdblock");
setaccel("CTRL SHIFT VK_SPACE","macros(KM_ToggleAdblock)");
}
$OnInit=$OnInit."_KM_ToggleAdblock_BuildMenu;";
$macroModules=$macroModules."KM_ToggleAdblock;";
Ouch.... main prob here:
KM_ToggleAdblock{
macroinfo=_("Toggle Adblock");
macros("KM_ToggleAdblock");
}
You are DELETING a native macro that is defined in main.kmm, and replace it with your own version. And your own version really does nothing except calling itself over and over - an endless loop!
If all you want is to add a shortcut and setmenu line, do only this:
KM_ToggleAdblock{
macroinfo=_("Toggle Adblock");
macros("KM_ToggleAdblock");
}
_KM_ToggleAdblock_BuildMenu{
setmenu("Nav",macro,"Author/User","KM_ToggleAdblock");
setaccel("CTRL SHIFT VK_SPACE","macros(KM_ToggleAdblock)");
}
$OnInit=$OnInit."_KM_ToggleAdblock_BuildMenu;";
$macroModules=$macroModules."KM_ToggleAdblock_menu;";
But your menuline "Author/User" is completely uncomprehensible without previous knowledge that you actually toggle your userContent.css with the adblock toggle, and want to mimick Opera-styles. Of course, for your OWN macro it's fine whatever you want, just noting this hint for other readers.
If you plan to add more menu+shortcuts this way, for already existing macro actions, you can combine them all into 1 macro, for example:
_myMacro_MenusAccels{
setmenu("Nav",macro,"Author/User","KM_ToggleAdblock");
setmenu("menuname",macro,"menu text2","macroname2");
setmenu("menuname",macro,"menu text3","macroname3");
setaccel("CTRL SHIFT VK_SPACE","macros(KM_ToggleAdblock)");
setaccel("shortcut2","macros(macroname2)");
setaccel("shortcut3","macros(macroname3)");
}
The usual way for SUCH cases, to only add menulines and shortcuts for already existing native menus, would be to do what Hermes suggested: tweak menus.cfg. And add the shortcut in accel.cfg
HowTo: For example add at the bottom of
menus.cfg:
!Nav{
Author User Styles=macros(KM_ToggleAdblock)
}
The "!" before the menu name means: modify it.
If you want to define a line position, it's possible to add a number 0-99 at end:
Author User Style=macros(KM_ToggleAdblock)|0
Such modifications should work in
menus.cfg in the profile.
But due to an old bug with the rebarmenu plugin it may not, then add those changes *additionally* at the bottom of the global menus.cfg in .../k-meleon/browser/defaults/settings/menus.cfg
The prob is, changes in those
default files can accidentally get lost when installing a new KM-version, which overwrites those files again. As backup I'd keep a copy in the same folder, renamed to menus_myChanges.cfg. Same trick for accel.cfg Just to make it easier to find and restore the own settings again later, after updating KM, by doing a file search for all backup files with "mychanges" in their name.
Edited 5 time(s). Last edit at 08/19/2019 03:26PM by siria.