CustomizableUI

Discussion about official Mozilla Thunderbird builds
Post Reply
morat
Posts: 6404
Joined: February 3rd, 2009, 6:29 pm

CustomizableUI

Post by morat »

Is the CustomizableUI module being implemented in Thunderbird 68? Any info?

Implement CustomizableUI for SeaMonkey and Thunderbird
http://bugzilla.mozilla.org/show_bug.cgi?id=1011857
http://bugzilla.mozilla.org/show_bug.cgi?id=1119948

CustomizableUI
http://developer.mozilla.org/docs/Mozil ... ableUI.jsm
http://developer.mozilla.org/docs/Mozil ... ed_widgets

I noticed the CustomizableUI property is available in the 3pane window and message window in Thunderbird 68.

I tried adding a button using the createWidget method in Thunderbird 68 like I do in Firefox 68, but the createWidget method fails silently.

Firefox Quantum compatible userChrome.js
http://github.com/Sporif/firefox-quantum-userchromejs

Restart Button for Firefox
http://gist.github.com/Sporif/ad6e917d8 ... 80d3c8918c

Thunderbird example:

* chrome\userChrome.css

Code: Select all

/* Thunderbird userChrome.css */

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

toolbarbutton#alltabs-button {
  -moz-binding: url("userChrome.xml#js") !important; /* fails without !important */
}
* chrome\userChrome.xml

http://github.com/Sporif/firefox-quantu ... Chrome.xml

* chrome\TestThunderbirdButton_Movable.uc.js

Code: Select all

(function () {
  if (location != "chrome://messenger/content/messenger.xul") return;

  /* CustomizableUI
     http://developer.mozilla.org/docs/Mozilla/JavaScript_code_modules/CustomizableUI.jsm
     http://developer.mozilla.org/docs/Mozilla/JavaScript_code_modules/CustomizableUI.jsm/API-provided_widgets
  */

  console.log("CustomizableUI test"); // logs correctly

  try {
    CustomizableUI.createWidget({
      id: "__unique_identifier_test_button", // should match id below
      type: "button",
      defaultArea: "mail-toolbar-menubar2", // Menu Bar     toolbar id
   // defaultArea: "mail-bar3",             // Mail Toolbar toolbar id
      label: "Test",
      tooltiptext: "Test" + "\n" + "\n" + "L: alert test" + "\n" + "R: open button context popup",
      onCommand: function (aEvent) {
        var win = aEvent.target.ownerDocument.defaultView;
        win.alert("test");
      },
    });
  } catch (e) {
    Components.utils.reportError(e);
  };

  var ios = Components.classes["@mozilla.org/network/io-service;1"].
    getService(Components.interfaces.nsIIOService);
  var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].
    getService(Components.interfaces.nsIStyleSheetService);
  var dataUrl = "data:image/png;base64," +
    "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAhpJRE" +
    "FUOMvN0UtI1FEUx/HvnfufV874n0lHfJQjlWTS6EKIxCFqE0S0yxaBLoooCIxoUbaIQCxy" +
    "kT1oE0Utgh6Q0M4kCiE3qYuIFmG+KPMx5gzTjP7Hmfu/LSIz0B606awu9xw+91x+8I8lVm" +
    "sMXmfzghF+hMMXZO7tkWgrT/9KfnPb35uc6tbz0090363qT6NX8a0051jpcuQujYHqQztQ" +
    "M+SscTZs31cykqL1j4DhHjwJwh0F4RrG+zsZHrhBQTCBWR45+eoCFb8FrBFOldYdrshOP6" +
    "D2wBi7jhrEPj5jY7TKm9SOS78EPjyk1C6sO+MJrMUpv5DvC1BU4CftVLi8s4S2rG980U50" +
    "VeBznIvFkf2+XGYSb5FJTZXENN1URhRKzVC50yFiyMt6WXry++HdTbYZ6/Zcyy8OC61iCK" +
    "lJZd4TDBWyu8Eia8cx3HG8edmy7pAe7XrJ6+UbiFQu70rJ1r0OlY2DSLOYs2hqLub4MReZ" +
    "xQTSGUfINJX1NqZJe9dZ8paA520cDESa67VKg7AQIoMhU/Q/HmKodwCnN4l0LeJ0f3utoY" +
    "myqQlOLwHaX36uaFMUpdJAFhxZvMzRcS/I+Tt1yDUC6f7x4WAZhGs5AWAAGJ6QaRgC2+UC" +
    "IUEIMp58enomUa4JwEIaP8e3kGR+CZgcGmzpu9/WKQ3h1/Y8WufQ2gIy2HpWaTRag7axlU" +
    "anZoklpmjhv6ivwhPCjfsi85IAAAAASUVORK5CYII=";
  var css = "#__unique_identifier_test_button {";
  css += 'list-style-image: url("' + dataUrl + '") !important;';
  css += "-moz-image-region: auto !important;";
  css += "}";
  css += '#mail-toolbar-menubar2 .menubar-text {'; // styles correctly
  css += "color: orange !important;";
  css += "}";
  var uri = ios.newURI("data:text/css," + encodeURIComponent(css), null, null);
  if (!sss.sheetRegistered(uri, sss.USER_SHEET)) {
    sss.loadAndRegisterSheet(uri, sss.USER_SHEET);
  }
})();
Reference - Thunderbird 60
http://dxr.mozilla.org/comm-esr60/searc ... omizableUI
http://dxr.mozilla.org/comm-esr60/sourc ... ersion.txt

Reference - Thunderbird 68
http://dxr.mozilla.org/comm-release/sea ... omizableUI
http://dxr.mozilla.org/comm-release/sou ... ersion.txt
User avatar
Paenglab
Posts: 206
Joined: December 30th, 2006, 2:20 am
Location: Switzerland

Re: CustomizableUI

Post by Paenglab »

No, only the part that was needed for the port of the Appmenu.
Nuvola theme for Firefox and Thunderbird
morat
Posts: 6404
Joined: February 3rd, 2009, 6:29 pm

Re: CustomizableUI

Post by morat »

Thanks for reply.
Post Reply