benzBrake / FirefoxCustomize

Ryan 收集的 Firefox 个性化相关资源
153 stars 34 forks source link

SidebarModoki #9

Closed Orriky closed 1 year ago

Orriky commented 1 year ago

Hi,

I'd like to add two extensions in SidebarModoki. They are BitWarden and Checkmarks. However, BitWarden is by far more important. Is it possible?

Thanks

benzBrake commented 1 year ago

Replace https://github.com/benzBrake/FirefoxCustomize/blob/75cc81dae4095ebb504c31d622736f46029928e1/userChromeJS/SidebarModoki.uc.js#L60-L83 with

  TABS: [{
    src: "chrome://browser/content/places/bookmarksSidebar.xhtml",
    "data-l10n-id": "library-bookmarks-menu",
  }, {
    src: "chrome://browser/content/places/historySidebar.xhtml",
    "data-l10n-id": "appmenuitem-history",
  }, {
    src: "chrome://browser/content/downloads/contentAreaDownloadsView.xhtml?SM",
    "data-l10n-id": "appmenuitem-downloads",
  }, {
    hidden: async function () {
      let tst = await AddonManager.getAddonByID("treestyletab@piro.sakura.ne.jp");
      return !tst?.isActive;
    },
    src: async function () {
      let tst = await AddonManager.getAddonByID("treestyletab@piro.sakura.ne.jp");
      if (tst && tst.isActive) {
        return tst.optionsURL.replace("options/options.html", "sidebar/sidebar.html");
      } else {
        return "";
      }
    },
    label: "TST"
  }, {
    hidden: async function () {
      let addon = await AddonManager.getAddonByID("{446900e4-71c2-419f-a6a7-df9c091e268b}");
      return !addon?.isActive;
    },
    src: async function () {
      let policy = WebExtensionPolicy.getByID("{446900e4-71c2-419f-a6a7-df9c091e268b}");
      if (policy && policy.active) {
        return "moz-extension://" + policy.mozExtensionHostname + "/popup/index.html";
      } else {
        return "";
      }
    },
    label: "Bitwarden"
  }, {
    hidden: async function () {
      let addon = await AddonManager.getAddonByID("{bd97f89b-17ba-4539-9fec-06852d07f917}");
      return !addon?.isActive;
    },
    src: async function () {
      let policy = WebExtensionPolicy.getByID("{bd97f89b-17ba-4539-9fec-06852d07f917}");
      if (policy && policy.active) {
        return "moz-extension://" + policy.mozExtensionHostname + "/sidebar/checkmarks-sidebar.html";
      } else {
        return "";
      }
    },
    label: "Checkmarks"
  }],

And then you need to custom icon with userChrom.css like

#SM_tabs [label="Checkmarks"] {
    list-style-image: ("abc.svg")
}
Orriky commented 1 year ago

Thanks!!! I'd like to have buttons above all. Buttons instead of SidebarModoki header (imho, it takes up space unnecessarily). Also, can you assign a shortcut for each button?

benzBrake commented 1 year ago

Currently, no free time to implement this feature. I have 4 exams next week. New Year's Day restart to modify scripts

benzBrake commented 1 year ago

Or you can use KeyChanger https://github.com/benzBrake/FirefoxCustomize/blob/master/userChromeJS/KeyChanger/KeyChanger.uc.js to cumtom shortcuts.

keys['F1'] = function () {
    document.getElementById("SM_tab1").click();
};

Demo config:https://github.com/benzBrake/FirefoxCustomize/blob/master/userChromeJS/KeyChanger/_keychanger.js

Orriky commented 1 year ago

Hi,

KeyChanger is very useful. About buttons position I achieve my goal with this:

 @namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
  #SM_header {
    display: none;
  }
   #SM_tabbox {
    display: top;
 }
  #SM_tabs {
    flex-direction: row;
  }
  }

Is it possible an alternative key combination to cycle buttons (or prev/next button) that doesn't affect regular Tab?

benzBrake commented 1 year ago

you could use Ctrl + Wheel to switch SidebarModoki tab

Orriky commented 1 year ago

Hi,

Thanks Ctrl + Wheel enlarges/reduces text, and it doesn't switch SidebarModoki tab ALT + Q don't do anything in my laptop. I don't have at the moment my pc Also, custom icon (as you previously suggested) doesn't work anymore

benzBrake commented 1 year ago

Hi,

Thanks Ctrl + Wheel enlarges/reduces text, and it doesn't switch SidebarModoki tab ALT + Q don't do anything in my laptop. I don't have at the moment my pc Also, custom icon (as you previously suggested) doesn't work anymore

Accel means ctrl, so the demo shortcut is ctrl + alt + q Ctrl + Wheel to swich require the mouse hover on the SidebarModoki Tabbar new version support customizing image in tabs config

{
        "addon-id": "treestyletab@piro.sakura.ne.jp",
        src: "sidebar/sidebar.html",
        image: "abc.svg",
        label: "TST"
}
Orriky commented 1 year ago

Thanks!!!