{"id":2265,"date":"2011-02-16T19:34:53","date_gmt":"2011-02-17T03:34:53","guid":{"rendered":"http:\/\/blog.mozilla.org\/addons\/?p=2265"},"modified":"2011-02-17T07:59:25","modified_gmt":"2011-02-17T15:59:25","slug":"toolbar-buttons-firefox-4-revisited","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/addons\/2011\/02\/16\/toolbar-buttons-firefox-4-revisited\/","title":{"rendered":"Toolbar buttons in Firefox 4 &#8211; revisited"},"content":{"rendered":"<p><strong>Update:<\/strong> I initially indicated these changes applied to beta 11, when it reality they apply to beta 12. You can test this on the currently nightlies or wait for beta 12 to try it out. The samples work on beta 11, with only one bug: if the toolbar is in large icons mode, the large icon will be used and scaled down on themes where icons are always small, like on Windows.<\/p>\n<p>A couple of months ago I wrote an overview of <a href=\"http:\/\/blog.mozilla.org\/addons\/2010\/12\/02\/toolbar-buttons-in-firefox-4\/\">toolbar buttons in Firefox 4<\/a>, including all the CSS and image work necessary for your add-ons to work on all 3 platforms. It was met with many questions, the gist of them being <em>why is this so convoluted when it could be really simple?<\/em> So, bugs were filed and revisited, and many problems were finally solved.<\/p>\n<p>Firefox 4 beta 12 will contain fixes for <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=626382\">bug 626382<\/a> and <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=616472\">bug 616472<\/a>, both of which bring the necessary icon and styling work down to almost the bare minimum. You can test these changes on the current nightlies<\/p>\n<p>First of all, if you followed the recommendations in the previous article, no changes should be required. I tested the add-on I created for that post on the latest beta on all platforms and it worked just the same. So, if you already did the compatibility work for Firefox 4 testing in earlier betas, you should be good. Now let&#8217;s get to the new, simpler way of doing this.<\/p>\n<p>Assuming you want to support all 3 major platforms and your add-on adds a toolbar button, the minimum you need is a 16&#215;16 px icon and a 24&#215;24 px icon. The 24&#215;24 px icon is normally only used on the default Linux theme (I tested on Ubuntu) on Large Icons mode, which is the default value for the main toolbar. For all other platforms and modes, the 16x16px icon is used, with varying margins around it on Windows. In terms of CSS, all you need is this:<\/p>\n<pre>#icondemo-toolbar-button {\r\n list-style-image: url(\"chrome:\/\/icondemo\/skin\/toolbar-large.png\");\r\n}\r\n\r\ntoolbar[iconsize=\"small\"] #icondemo-toolbar-button {\r\n list-style-image: url(\"chrome:\/\/icondemo\/skin\/toolbar.png\");\r\n}<\/pre>\n<p>Nothing else is needed.<\/p>\n<p>Now, if you want to take this one step further and be a better Mac OS X citizen, your icon will look much better if it&#8217;s monochrome. For this, I recommend using <a href=\"https:\/\/developer.mozilla.org\/en\/Chrome_Registration#Manifest_Flags\">chrome manifest flags<\/a> to either have completely different skins altogether, or just override the main skin with the Mac OS skin when necessary. The sample add-on in the previous article uses the former, the sample add-on in this one uses the latter.<\/p>\n<p>Here&#8217;s a link to the <a href=\"http:\/\/xulforge.com\/mozilla\/icondemo2.xpi\">demo add-on I adjusted<\/a> for the new system. It&#8217;s simpler and smaller because of one icon and some CSS files that weren&#8217;t needed anymore.<\/p>\n<p>If you&#8217;re a theme author or you want to understand the details of the new system, perhaps if you need specially-sized icons for your add-on, you should read <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=626382#c99\">this comment<\/a> that explains the changes very well. Alfred Kayser also maintains <a href=\"http:\/\/forums.mozillazine.org\/viewtopic.php?f=18&amp;t=1418995\">this Mozillazine thread<\/a> up to date with everything that concerns theme authors. Thank you, Alfred!<\/p>\n<p>Also, special thanks to Dao and Paolo for all the hard work they put into resolving these bugs!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update: I initially indicated these changes applied to beta 11, when it reality they apply to beta 12. You can test this on the currently nightlies or wait for beta &hellip; <a class=\"go\" href=\"https:\/\/blog.mozilla.org\/addons\/2011\/02\/16\/toolbar-buttons-firefox-4-revisited\/\">Read more<\/a><\/p>\n","protected":false},"author":173,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[388,44,295],"tags":[805,278877,278873,278876,888,6743],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Toolbar buttons in Firefox 4 - revisited - Mozilla Add-ons Community Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.mozilla.org\/addons\/2011\/02\/16\/toolbar-buttons-firefox-4-revisited\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jorge Villalobos\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2011\/02\/16\/toolbar-buttons-firefox-4-revisited\/\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/2011\/02\/16\/toolbar-buttons-firefox-4-revisited\/\",\"name\":\"Toolbar buttons in Firefox 4 - revisited - Mozilla Add-ons Community Blog\",\"isPartOf\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#website\"},\"datePublished\":\"2011-02-17T03:34:53+00:00\",\"dateModified\":\"2011-02-17T15:59:25+00:00\",\"author\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/a098261b4b5510d408ff31f492606925\"},\"breadcrumb\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2011\/02\/16\/toolbar-buttons-firefox-4-revisited\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.mozilla.org\/addons\/2011\/02\/16\/toolbar-buttons-firefox-4-revisited\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2011\/02\/16\/toolbar-buttons-firefox-4-revisited\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.mozilla.org\/addons\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Toolbar buttons in Firefox 4 &#8211; revisited\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#website\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/\",\"name\":\"Mozilla Add-ons Community Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.mozilla.org\/addons\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/a098261b4b5510d408ff31f492606925\",\"name\":\"Jorge Villalobos\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6d1966118f16e4b99a6e3ad07883be33?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6d1966118f16e4b99a6e3ad07883be33?s=96&d=mm&r=g\",\"caption\":\"Jorge Villalobos\"},\"description\":\"Jorge is the Product Manager for addons.mozilla.org\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/author\/jvillalobosmozilla-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Toolbar buttons in Firefox 4 - revisited - Mozilla Add-ons Community Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.mozilla.org\/addons\/2011\/02\/16\/toolbar-buttons-firefox-4-revisited\/","twitter_misc":{"Written by":"Jorge Villalobos","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/blog.mozilla.org\/addons\/2011\/02\/16\/toolbar-buttons-firefox-4-revisited\/","url":"https:\/\/blog.mozilla.org\/addons\/2011\/02\/16\/toolbar-buttons-firefox-4-revisited\/","name":"Toolbar buttons in Firefox 4 - revisited - Mozilla Add-ons Community Blog","isPartOf":{"@id":"https:\/\/blog.mozilla.org\/addons\/#website"},"datePublished":"2011-02-17T03:34:53+00:00","dateModified":"2011-02-17T15:59:25+00:00","author":{"@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/a098261b4b5510d408ff31f492606925"},"breadcrumb":{"@id":"https:\/\/blog.mozilla.org\/addons\/2011\/02\/16\/toolbar-buttons-firefox-4-revisited\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.mozilla.org\/addons\/2011\/02\/16\/toolbar-buttons-firefox-4-revisited\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.mozilla.org\/addons\/2011\/02\/16\/toolbar-buttons-firefox-4-revisited\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.mozilla.org\/addons\/"},{"@type":"ListItem","position":2,"name":"Toolbar buttons in Firefox 4 &#8211; revisited"}]},{"@type":"WebSite","@id":"https:\/\/blog.mozilla.org\/addons\/#website","url":"https:\/\/blog.mozilla.org\/addons\/","name":"Mozilla Add-ons Community Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.mozilla.org\/addons\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/a098261b4b5510d408ff31f492606925","name":"Jorge Villalobos","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6d1966118f16e4b99a6e3ad07883be33?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6d1966118f16e4b99a6e3ad07883be33?s=96&d=mm&r=g","caption":"Jorge Villalobos"},"description":"Jorge is the Product Manager for addons.mozilla.org","url":"https:\/\/blog.mozilla.org\/addons\/author\/jvillalobosmozilla-com\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts\/2265"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/users\/173"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/comments?post=2265"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts\/2265\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/media?parent=2265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/categories?post=2265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/tags?post=2265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}