K-Meleon

KMeleonWiki > Resources > MacroLibrary > KmmSearchIcon

Submitted by: JamesD and desga2


Special appreciation to desga2, without whose help this macro would never have gotten done.

Notes:

SearchIcon macro will display the icon for the general search engine on the search button. The icons required for this can be downloaded as a 7z compressed file from http://www.perigee.net/~jmd8421r/SearchIconBMP.7z .

Extract the icons to your K-Meleon skins\Default folder. If you do not already have a Default folder under skins, then create one.

In order to change the icon when the search engine is changed it is necessary to edit one of K-Meleon's macros and insert one line of code. Go to the K-Meleon root\macros folder and edit search.kmm. Find the following code. It should start at or near line 49. Add the line "&_SearchIcon_RunCode;".

Search_Engine{
macroinfo=_("Search the Web using the specified engine");
menuchecked=(getpref(STRING,$_Search_pref_Engine.$ARG.".url")==getpref(STRING,$_Search_pref_DefaultURL));
$_n=$ARG; &_Search;
&_SearchIcon_RunCode;
}

SearchIcon.kmm can easily be edited to include additional search engines. In fact one engine not shipped with KM has already been added. That engine is named Clusty. You may add Clusty to KM by going to TOOLS - WEB SEARCH - CONFIGURE - SEARCH ENGINES - ADD. The information for Clusty is as follows:

Caption:: Clusty
URL:::    http://clusty.com/search?input-form=clusty-simple&v%3Asources=webplus&query=


The information on how to edit the macro is included within SearchIcon.kmm.

Special note: If you have "set as default" checked, then the general search engine never changes and you will see only the icon for the default engine.




Open your User Macro Folder (Edit > Configuration > User-Defined Macros) or your Macro Folder (Edit > Configuration > Macros) and create the following text file:

SearchIcon.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#  
# ---------- SearchIcon.kmm
# ---------- K-Meleon Macro Language  Display Search Engine Icons in Search Button  ---
#
# Dependencies        : - main.kmm Search.kmm KM ver 1.5.0 or later
# Resources           : - 
# Preferences         : - "kmeleon.general.searchEngineName"
# Version             : - 0.8   2008-12-16
# By                  : - JamesD and desga2
# --------------------------------------------------------------------------------

_SearchIcon_RunCode{
        # first reset button image index to the default for the case the new engine 
        # is not one of the engines below.
        $_SearchIconIndex = 80 ;
        
        $_SearchIconSearchName = getpref(STRING,"kmeleon.general.searchEngineName") ;
        if ($_SearchIconSearchName == _("A9.com")) $_SearchIconIndex = 0 ;
        if ($_SearchIconSearchName == _("Acronym Finder")) $_SearchIconIndex = 2 ;
        if ($_SearchIconSearchName == _("AlltheWeb.com")) $_SearchIconIndex = 4 ;
        if ($_SearchIconSearchName == _("AltaVista")) $_SearchIconIndex = 6 ;
        if ($_SearchIconSearchName == _("Amazon.com")) $_SearchIconIndex = 8 ;
        if ($_SearchIconSearchName == _("Answers.com")) $_SearchIconIndex = 10 ;        
        if (substr($_SearchIconSearchName,0,3) == _("AOL")) $_SearchIconIndex =  12;
        if ($_SearchIconSearchName == _("Ask.com")) $_SearchIconIndex = 14 ;        
        if ($_SearchIconSearchName == _("Astalavista.box.sk")) $_SearchIconIndex = 16 ;        
        if ($_SearchIconSearchName == _("Del.icio.us")) $_SearchIconIndex = 18 ;
        if ($_SearchIconSearchName == _("Dictionary.com")) $_SearchIconIndex = 20 ;        
        if ($_SearchIconSearchName == _("Dogpile")) $_SearchIconIndex = 22 ;        
        if ($_SearchIconSearchName == _("eBay.com")) $_SearchIconIndex = 24 ;
        if ($_SearchIconSearchName == _("Find Travel To")) $_SearchIconIndex = 26 ;
        if ($_SearchIconSearchName == _("GameFAQs Search")) $_SearchIconIndex = 28 ;
        if ($_SearchIconSearchName == _("Gigablast")) $_SearchIconIndex = 30 ;
        if (substr($_SearchIconSearchName,0,6) == _("Google")) $_SearchIconIndex =  32 ;
        if ($_SearchIconSearchName == _("HotBot")) $_SearchIconIndex = 34 ;        
        if ($_SearchIconSearchName == _("HowStuffWorks")) $_SearchIconIndex = 36 ;
        if (substr($_SearchIconSearchName,0,16) == _("Internet Movie D")) $_SearchIconIndex = 38 ;
        if ($_SearchIconSearchName == _("Ixquick Metasearch")) $_SearchIconIndex = 40 ;        
        if ($_SearchIconSearchName == _("Jux2")) $_SearchIconIndex = 42 ;
        if ($_SearchIconSearchName == _("K-Meleon Forums Search")) $_SearchIconIndex = 44 ;
        if (substr($_SearchIconSearchName,0,3) == _("LEO")) $_SearchIconIndex = 46;        
        if ($_SearchIconSearchName == _("Lycos")) $_SearchIconIndex = 48 ;
        if ($_SearchIconSearchName == _("Mamma Metasearch")) $_SearchIconIndex = 50 ;
        if ($_SearchIconSearchName == _("MetaCrawler")) $_SearchIconIndex = 52 ;
        if ($_SearchIconSearchName == _("MobyGames")) $_SearchIconIndex = 54 ;
        if ($_SearchIconSearchName == _("MSN Search")) $_SearchIconIndex = 56 ;
        if ($_SearchIconSearchName == _("Merriam-Webster Online Dictionary")) $_SearchIconIndex = 58 ;
        if ($_SearchIconSearchName == _("OneLook Dictionary Search")) $_SearchIconIndex = 60 ;
        if ($_SearchIconSearchName == _("Open Directory (dmoz.org)")) $_SearchIconIndex = 62 ;
        if ($_SearchIconSearchName == _("Search.com")) $_SearchIconIndex = 64 ;
        if ($_SearchIconSearchName == _("SnapFiles")) $_SearchIconIndex = 66 ;
        if (substr($_SearchIconSearchName,0,3) == _("Viv")) $_SearchIconIndex = 68 ;
        if (substr($_SearchIconSearchName,0,16) == _("Internet Archive")) $_SearchIconIndex = 70;        
        if ($_SearchIconSearchName == _("Weather.com")) $_SearchIconIndex = 72 ;
        if (substr($_SearchIconSearchName,0,8) == _("Webshots")) $_SearchIconIndex = 74 ;
        if (substr($_SearchIconSearchName,0,5) == _("Wikip")) $_SearchIconIndex = 76 ;        
        if (substr($_SearchIconSearchName,0,6) == _("Yahoo!")) $_SearchIconIndex = 78 ;

#### ---------  Add other defined search engines below  -------------------------
#### ---------  Increment index by one from current highest number  -----------------        
        if ($_SearchIconSearchName == _("Clusty")) $_SearchIconIndex = 82 ;
        if ($_SearchIconSearchName == _("Froogle")) $_SearchIconIndex = 83 ;

#### ---------  Add other defined search engines above   ------------------------        
        $_SearchIconIndex > 80 ? &_SearchIconNkButtons : &_SearchIconkButtons ;
        }
        
_SearchIconkButtons{
        $_SearchIconTag =  "&Search Buttons, macros(Search), COLD, SearchIconTool.bmp[". $_SearchIconIndex ."]" ;
        pluginmsg(toolbars, "SetButtonImage", $_SearchIconTag);
        $_SearchIconTag =  "&Search Buttons, macros(Search), HOT, SearchIconTool.bmp[". $_SearchIconIndex +1 ."]" ;
        pluginmsg(toolbars, "SetButtonImage", $_SearchIconTag);        
        }
        
_SearchIconNkButtons{
#### ---------   Each engine in other defined must have its icons assigned as below
#### ---------   Icons must be 16x16 bmp files located in Skins/Default        
        if ($_SearchIconIndex == 82) {
                $_SearchIconPicCold = "clusty cold.bmp";          
                $_SearchIconPicHot = "clusty hot.bmp";              
                }
        if ($_SearchIconIndex == 83) {
                $_SearchIconPicCold = "froogle cold.bmp";          
                $_SearchIconPicHot = "froogle hot.bmp";              
                }
                
####  For new engine, copy lines above, insert before this line, and edit information
#### ---------   end of other defined engines icon assignment
        $_SearchIconTagC =  "&Search Buttons, macros(Search), COLD,". $_SearchIconPicCold ;
        pluginmsg(toolbars, "SetButtonImage", $_SearchIconTagC);
        $_SearchIconTagH =  "&Search Buttons, macros(Search), HOT,". $_SearchIconPicHot ;
        pluginmsg(toolbars, "SetButtonImage", $_SearchIconTagH);                        
                }

$OnStartup=$OnStartup."_SearchIcon_RunCode;";
$macroModules=$macroModules."SearchIcon;";



Comments & Questions

K-Meleon

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