keyconfig 20110522

Announce and Discuss the Latest Theme and Extension Releases.
Post Reply
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

Hi!

How can I disable alt+[starting character] focusing the menu items on the menu bar? It's a garbage feature, the removes hotkey possibilities essentially randomly. (Based on what characters the menu names start with in your particular locale)

Even XUL addons like keyconfig can't override this apparently.
morat
Posts: 6406
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

@avada

You can set ui.key.menuAccessKey to 0 in about:config to disable them.

More info: http://forums.mozillazine.org/viewtopic ... &t=2169503

Also,

Code: Select all

document.getElementById("helpMenu").removeAttribute("accesskey");

Code: Select all

(function () {
  var menus = document.getElementById("main-menubar").children;
  for (var i = 0; i < menus.length; i++) {
    menus[i].removeAttribute("accesskey");
  }
})();
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

morat wrote:You can set ui.key.menuAccessKey to 0 in about:config to disable them.
Thanks. I assumed I could use -1 ui.key.* keys, one of them was even set to -1.
morat wrote:Also,

Code: Select all
document.getElementById("helpMenu").removeAttribute("accesskey");


Code: Select all
(function () {
var menus = document.getElementById("main-menubar").children;
for (var i = 0; i < menus.length; i++) {
menus.removeAttribute("accesskey");
}
})();


I guess this should go into an uc.js file?
morat
Posts: 6406
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

@avada

Put the code snippet with your initialization code.

e.g. mozilla.cfg or userChrome.js or whatever
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

Hi!
I have these as keys to open the two variants of quick findbar:

Code: Select all

gFindBar.startFind(gFindBar.FIND_TYPEAHEAD);

Code: Select all

gFindBar.startFind(gFindBar.FIND_LINKS);
They worked find in the past, but now they can only open the quick findbar, if the findbar was opened before manually for that tab. So not really useful like this.
morat
Posts: 6406
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

@avada

Try this:

Code: Select all

if (gFindBarInitialized) {
  alert("findbar initialized");
  gFindBar.startFind(gFindBar.FIND_TYPEAHEAD);
} else {
  alert("findbar not initialized");
  gFindBarPromise.then(function (fb) {
    fb.startFind(fb.FIND_TYPEAHEAD);
  });
}
Reference
http://searchfox.org/mozilla-release/se ... indCommand

FYI:

These are equivalent...

Code: Select all

gFindBarPromise.then(function (fb) {
  fb.startFind(fb.FIND_TYPEAHEAD);
});

Code: Select all

(async function () {
  var fb = await gFindBarPromise;
  fb.startFind(fb.FIND_TYPEAHEAD);
})();
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

morat wrote:@avada

Try this:

Code: Select all

if (gFindBarInitialized) {
  alert("findbar initialized");
  gFindBar.startFind(gFindBar.FIND_TYPEAHEAD);
} else {
  alert("findbar not initialized");
  gFindBarPromise.then(function (fb) {
    fb.startFind(fb.FIND_TYPEAHEAD);
  });
}
Reference
http://searchfox.org/mozilla-release/se ... indCommand

FYI:

These are equivalent...

Code: Select all

gFindBarPromise.then(function (fb) {
  fb.startFind(fb.FIND_TYPEAHEAD);
});

Code: Select all

(async function () {
  var fb = await gFindBarPromise;
  fb.startFind(fb.FIND_TYPEAHEAD);
})();
Thanks, it works.
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

@morat
Hi!
A good while ago got this code from you to hide the UI, reversibly via a hotkey:

Code: Select all

    var css = [];
    css.push("#TabsToolbar { visibility: collapse !important; }");
    //css.push("#navigator-toolbox {visibility: collapse;}");
    //css.push("browser {margin-right: -14px; margin-bottom: -14px;}");
    //css.push("#toolbar-menubar {visibility: collapse;}");
    // css.push("...");
    // css.push("...");
    // css.push("...");
    // css.push("...");
    var ios = Components.classes["@mozilla.org/network/io-service;1"].
      getService(Components.interfaces.nsIIOService);
    var uri = ios.newURI("data:text/css," + encodeURIComponent(css.join("\n")), null, null);
    var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].
      getService(Components.interfaces.nsIStyleSheetService);
    if (sss.sheetRegistered(uri, sss.USER_SHEET)) {
      sss.unregisterSheet(uri, sss.USER_SHEET);
    } else {
      sss.loadAndRegisterSheet(uri, sss.USER_SHEET);
    }
Which still works fine. I only use it for the tab bar now. What I want to ask is: Can it be changed to be applied by default and be shown via hotkey? I guess not with keyconfig, but maybe the code can be moved to a Custombuttons button.
morat
Posts: 6406
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

@avada

Run the code in a custom buttons init tab. Run the same code using a keyconfig hotkey.
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

morat wrote:@avada

Run the code in a custom buttons init tab. Run the same code using a keyconfig hotkey.
I had that thought as well. But it's not reliable. I'm quite sure it runs twice if I have two windows in the session. So it remains visible.
morat
Posts: 6406
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

@avada

Try something like:

* <profile folder>\user.js

Code: Select all

user_pref("extensions.custombuttons.css.initialized", false);
About user.js
http://kb.mozillazine.org/User.js_file

* a custom buttons init tab

Code: Select all

var pref = "extensions.custombuttons.css.initialized";
if (Services.prefs.getBoolPref(pref) == false) {
  var css = "#menubar-items { background-color: orange !important; }";
  var ios = Components.classes["@mozilla.org/network/io-service;1"].
    getService(Components.interfaces.nsIIOService);
  var uri = ios.newURI("data:text/css," + encodeURIComponent(css), null, null);
  var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].
    getService(Components.interfaces.nsIStyleSheetService);
  var type = sss.USER_SHEET;
  if (sss.sheetRegistered(uri, type)) sss.unregisterSheet(uri, type);
  else sss.loadAndRegisterSheet(uri, type);
  Services.prefs.setBoolPref(pref, true);
}
* a keyconfig hotkey

Code: Select all

var css = "#menubar-items { background-color: orange !important; }";
var ios = Components.classes["@mozilla.org/network/io-service;1"].
  getService(Components.interfaces.nsIIOService);
var uri = ios.newURI("data:text/css," + encodeURIComponent(css), null, null);
var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].
  getService(Components.interfaces.nsIStyleSheetService);
var type = sss.USER_SHEET;
if (sss.sheetRegistered(uri, type)) sss.unregisterSheet(uri, type);
else sss.loadAndRegisterSheet(uri, type);
P.S.

Here is how to run a code snippet once per session in each window.

Run once per session
http://odyseus.github.io/CustomButtons/ ... started-11
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

@morat
Thanks!
godzfire
Posts: 153
Joined: September 13th, 2009, 1:12 pm

Re: keyconfig 20110522

Post by godzfire »

I want to map View -> Message Source to something else. It's currently Command+U. I'd like to change it to just the u key, like r is reply and f is forward. How can I do that?
morat
Posts: 6406
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

@godzfire

Are you using the tbkeys or tbkey-lite addon?

The command to view message source...

Code: Select all

window.goDoCommand('cmd_viewPageSource');
You cannot run arbitrary javascript with tbkeys-lite.

You can use the cmd shorthand and func shorthand with tbkeys and tbkeys-lite.

Use the cmd shorthand for calling a command using the goDoCommand method.

For example, "cmd:cmd_nextMsg" is the same as "window.goDoCommand('cmd_nextMsg');".

Use the func shorthand for calling a function on the window object without a parameter.

For example, "func:MsgNewMessage" is the same as "window.MsgNewMessage();".

Tips: http://forums.mozillazine.org/viewtopic ... #p14872763
godzfire
Posts: 153
Joined: September 13th, 2009, 1:12 pm

Re: keyconfig 20110522

Post by godzfire »

That works, thanks!
Post Reply