keyconfig 20110522

Announce and Discuss the Latest Theme and Extension Releases.
Post Reply
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

@t3l0zvxqIiXuzuH0

Try this:

Code: Select all

var type = "navigator:browser";
var enumerator = Services.wm.getEnumerator(type);
enumerator.getNext();
if (enumerator.hasMoreElements()) {
  BrowserTryToCloseWindow();
}
t3l0zvxqIiXuzuH0
Posts: 92
Joined: August 17th, 2014, 5:57 am

Re: keyconfig 20110522

Post by t3l0zvxqIiXuzuH0 »

Woa, lighting-fast answer. Thanks once again, morat!
firefoxuse
Posts: 1086
Joined: November 8th, 2011, 12:06 pm

Re: keyconfig 20110522

Post by firefoxuse »

morat any help for me please?
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

Does anyone know how to start Adblock Plus Element hiding helper? It's hotkey is broken "null" and it's former hotkey is used I some web developer debugger stuff I never want to use, which keeps getting re-enabled no matter how many times I disable it.
I failed to find the command with dom inspector and such...
User avatar
JayhawksRock
Posts: 10433
Joined: October 24th, 2010, 8:51 am

Re: keyconfig 20110522

Post by JayhawksRock »

How about the Keyboard shortcuts like Ctrl-Shift-F3 and Ctrl-Shift-F
"The trouble with quotes on the internet is you never know if they are genuine" ...Abraham Lincoln
User avatar
tonymec
Posts: 734
Joined: October 15th, 2004, 2:58 am
Location: Ixelles (Brussels Capital Region, Belgium)
Contact:

Re: keyconfig 20110522

Post by tonymec »

avada wrote:Does anyone know how to start Adblock Plus Element hiding helper? It's hotkey is broken "null" and it's former hotkey is used I some web developer debugger stuff I never want to use, which keeps getting re-enabled no matter how many times I disable it.
I failed to find the command with dom inspector and such...

Some built-in hotkeys are snatched by the browser (or mailer) before keyconfig even has a chance to catch them; it depends on how the hotkey is accessed by the concerned routines. Hotkeys of this sort can never be disabled by keyconfig, which they bypass entirely.

About ABP Element Hiding Helper, I see a menuitem "Adblock Plus: Block Image…" at the bottom of the right-click context menu for an image; let me see if DOM Inspector can tell me something about that… hm, no, nothing I can understand as being the element hiding function. Sorry.

And yet, I have both "Adblock Plus" (now 2.6.6) and "Element Hiding Helper for Adblock Plus" (1.3) enabled (shown as "true" in the third column of the about:support "Troubleshooting Information" page).
Best regards,
Tony
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

avada wrote:Does anyone know how to start Adblock Plus Element hiding helper?

Preference: extensions.elemhidehelper.selectelement_key

Hotkey Ctrl+Shift+F3 can be changed in the preference. Hotkey configuration will automatically ignore combinations that are already taken, specifying multiple options in the preference is possible.

Try these:

Code: Select all

// simulate Ctrl+Shift+F3
var utils = document.commandDispatcher.focusedWindow.
  QueryInterface(Components.interfaces.nsIInterfaceRequestor).
  getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendKeyEvent("keypress", KeyEvent.DOM_VK_F3, 0,
  Event.CONTROL_MASK | Event.SHIFT_MASK);

Code: Select all

// ugly hack
setTimeout(function () {
  document.getElementById("abp-toolbarbutton").open = true;
  setTimeout(function () {
    document.getElementsByClassName("elemhidehelper-item")[0].doCommand();
    document.getElementById("abp-toolbarbutton").open = false;
  }, 250);
}, 250);
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

Thanks for the tips guys.

morat wrote:Preference: extensions.elemhidehelper.selectelement_key

Hotkey Ctrl+Shift+F3 can be changed in the preference. Hotkey configuration will automatically ignore combinations that are already taken, specifying multiple options in the preference is possible.

Try these:

Cool. I'll have a look.

tonymec wrote:Some built-in hotkeys are snatched by the browser (or mailer) before keyconfig even has a chance to catch them; it depends on how the hotkey is accessed by the concerned routines. Hotkeys of this sort can never be disabled by keyconfig, which they bypass entirely.

What's unusual is that I see the hotkey in keyconfig and I can disable it. But it only works until I restart the browser.

JayhawksRock wrote:How about the Keyboard shortcuts like Ctrl-Shift-F3 and Ctrl-Shift-F

Well, the first is in conflict with flashgot the second is for adblock plus filter settings.
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

morat wrote:Try these:

Code: Select all
// simulate Ctrl+Shift+F3
var utils = document.commandDispatcher.focusedWindow.
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendKeyEvent("keypress", KeyEvent.DOM_VK_F3, 0,
Event.CONTROL_MASK | Event.SHIFT_MASK);


Is there a reason why wouldn't this work for alt+[numeric]. I added alt+x in the extensions.elemhidehelper.selectelement_key, and I thought I'd add the old ctrl+shift+s to simulate it. As it turns it doesn't work for some reason, it works with alt+Fx though...
User avatar
WildcatRay
Posts: 7484
Joined: October 18th, 2007, 7:03 pm
Location: Columbus, OH

Re: keyconfig 20110522

Post by WildcatRay »

A search of the thread using "clear" and "cache" did not turn up any code for clearing the browser cache. Could someone find the code for me, please? Thanks.
Last edited by WildcatRay on November 15th, 2014, 7:29 am, edited 1 time in total.
Ray

OS'es: 4 computers with Win10 Pro 64-bit; Current Firefox, Beta, Nightly, Chrome, Vivaldi
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

@avada

Preference: extensions.elemhidehelper.selectelement_key
Value: Accel Shift K, Accel Shift S, Accel Shift F3

Code: Select all

// simulate Ctrl+Shift+K
var utils = document.commandDispatcher.focusedWindow.
  QueryInterface(Components.interfaces.nsIInterfaceRequestor).
  getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendKeyEvent("keypress", 0, KeyEvent.DOM_VK_K,
  Event.CONTROL_MASK | Event.SHIFT_MASK);

Code: Select all

// simulate Ctrl+Shift+S
var utils = document.commandDispatcher.focusedWindow.
  QueryInterface(Components.interfaces.nsIInterfaceRequestor).
  getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendKeyEvent("keypress", 0, KeyEvent.DOM_VK_S,
  Event.CONTROL_MASK | Event.SHIFT_MASK);

Code: Select all

// simulate Ctrl+Shift+F3
var utils = document.commandDispatcher.focusedWindow.
  QueryInterface(Components.interfaces.nsIInterfaceRequestor).
  getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendKeyEvent("keypress", KeyEvent.DOM_VK_F3, 0,
  Event.CONTROL_MASK | Event.SHIFT_MASK);

Preference: extensions.elemhidehelper.selectelement_key
Value: Alt 1

Code: Select all

// simulate Alt+1
var utils = document.commandDispatcher.focusedWindow.
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendKeyEvent("keypress", 0, KeyEvent.DOM_VK_1,
  Event.ALT_MASK);

Remember to restart the browser after modifying the preference.
avada
Posts: 1932
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Re: keyconfig 20110522

Post by avada »

morat wrote:@avada

Preference: extensions.elemhidehelper.selectelement_key
Value: Accel Shift K, Accel Shift S, Accel Shift F3

Remember to restart the browser after modifying the preference.


Huh. Apparently the problem was the order of parameters.

Had:

Code: Select all

utils.sendKeyEvent("keypress", KeyEvent.DOM_VK_X, 0, Event.ALT_MASK)

Instead of:

Code: Select all

utils.sendKeyEvent("keypress", 0, KeyEvent.DOM_VK_X, Event.ALT_MASK)
firefoxuse
Posts: 1086
Joined: November 8th, 2011, 12:06 pm

Re: keyconfig 20110522

Post by firefoxuse »

anyone for my request??????????
xsane
Posts: 2
Joined: November 16th, 2014, 12:34 pm

Thunderbird vi vim VimFx

Post by xsane »

Searched, couldn't find. 190 pages is to long to read.

So, I wanted to have Thunderbird feel similar to the Firefox VimFx extension; mostly so
I would stop sending all my mail to the junk folder by trying to scroll down with the 'j' key.

Most of it was straight forward except Prev Tab and Next Tab. Here is what I came up with:

Prev Tab

Code: Select all

var curtab = document.getElementById("tabmail");
var tablen = curtab.tabInfo.length - 1;
var tabindex = curtab.tabContainer.selectedIndex;
tabindex == 0 ? tabindex = tablen : tabindex--;
curtab.switchToTab(tabindex);

Next Tab

Code: Select all

var curtab = document.getElementById("tabmail");
var tablen = curtab.tabInfo.length - 1;
var tabindex = curtab.tabContainer.selectedIndex;
tabindex == tablen ? tabindex = 0 : tabindex++;
curtab.switchToTab(tabindex);


Here are the rest of the mappings:

WELL KNOWN KEYS -- VIM / LESS / vimFX

Code: Select all

C-w      close (needed for edit window)
x        close
q        quit
g        page top
S-g      page bottom
u        page up
space    page down
h        scroll left
j        scroll line up
k        scroll line down
l        scroll right
/        Find in message
n        find Next
S-n      find prev
S-k      next tab
S-j      prev tab

MORE THUNDERBIRD SPECIFIC MAPPINGS

Code: Select all

o        toggle offline
i        fetch current account
f        next message
S-f      next unread
s        next panel
d        prev message
S-d      prev unread
S-s      prev panel
S-e      Collapse all threads
e        Expand   all threads
m        toggle message pane
r        toggle Read
S-r      Mark all read (in folder)
?        focus global search box (must be visible)
b        address Book
c        Calendar
S-h      back    (message history)
S-l      forward (message history)

F4    copy to clipboard all key_command operations for the installed Tbird version.

The last one is Morat's command grabber script, thanks Morat!

HERE ARE THE prefs.js ADDITIONS TO MAKE IT ALL HAPPEN:

Code: Select all

user_pref("keyconfig.global.20110522", "");
user_pref("keyconfig.main.key_addressbook", "][B][");
user_pref("keyconfig.main.key_close", "control][W][");
user_pref("keyconfig.main.key_close2", "][X][");
user_pref("keyconfig.main.key_collapseAllThreads", "shift][E][");
user_pref("keyconfig.main.key_expandAllThreads", "][E][");
user_pref("keyconfig.main.key_find", "][/][");
user_pref("keyconfig.main.key_findAgain", "][N][");
user_pref("keyconfig.main.key_findPrev", "shift][N][");
user_pref("keyconfig.main.key_forward", "!][][");
user_pref("keyconfig.main.key_getNewMessages", "][I][");
user_pref("keyconfig.main.key_goBack", "shift][H][");
user_pref("keyconfig.main.key_goChat", "!][][");
user_pref("keyconfig.main.key_goForward", "shift][L][");
user_pref("keyconfig.main.key_goStartPage", "!][][");
user_pref("keyconfig.main.key_killSubthread", "!][][");
user_pref("keyconfig.main.key_killThread", "!][][");
user_pref("keyconfig.main.key_markAllRead", "shift][R][");
user_pref("keyconfig.main.key_markJunk", "!][][");
user_pref("keyconfig.main.key_markNotJunk", "!][][");
user_pref("keyconfig.main.key_markReadByDate", "!][][");
user_pref("keyconfig.main.key_markThreadAsRead", "!][][");
user_pref("keyconfig.main.key_nextUnreadMsg", "shift][F][");
user_pref("keyconfig.main.key_previousMsg", "][D][");
user_pref("keyconfig.main.key_previousUnreadMsg", "shift][D][");
user_pref("keyconfig.main.key_quickSearchFocus", "shift][?][");
user_pref("keyconfig.main.key_quit", "][Q][");
user_pref("keyconfig.main.key_toggleFlagged", "!][][");
user_pref("keyconfig.main.key_toggleMessagePane", "][M][");
user_pref("keyconfig.main.key_toggleRead", "][R][");
user_pref("keyconfig.main.key_watchThread", "!][][");
user_pref("keyconfig.main.openLightningKey", "][C][");
user_pref("keyconfig.main.xxx_key_Commands2Clipboard", "][][VK_F4][// copy list of commands to clipboard\n// some commands are only legal when there is a selection\n// or when the focus is anywhere where you can type text\nvar commands = document.getElementsByTagName(\"command\");\nvar out = new Array();\nvar info = Components.classes[\"@mozilla.org/xre/app-info;1\"].\n  getService(Components.interfaces.nsIXULAppInfo);\nvar type = document.documentElement.getAttribute(\"windowtype\");\nout.push(info.name + \" \" + info.version, \"\", type, \"\");\nfor (var i = 0; i < commands.length; i++) {\n  var id = commands[i].getAttribute(\"id\");\n  var oncommand = commands[i].getAttribute(\"oncommand\");\n  if (id && oncommand) out.push(id);\n}\nvar req =  new XMLHttpRequest();\nreq.open(\"GET\", \"chrome://global/content/platformHTMLBindings.xml\", false);\nreq.send(null);\nvar doc = req.responseXML;\nvar handlers = doc.getElementsByTagName(\"handler\");\nfor (var i = 0; i < handlers.length; i++) {\n  var command = handlers[i].getAttribute(\"command\");\n  if (command && out.indexOf(command) == -1) out.push(command);\n}\nvar clipboard = Components.classes[\"@mozilla.org/widget/clipboardhelper;1\"].\n  getService(Components.interfaces.nsIClipboardHelper);\nif (navigator.platform.indexOf(\"Win\")) {\n  clipboard.copyString(out.join(\"\\n\"));\n} else {\n  clipboard.copyString(out.join(\"\\r\\n\"));\n}\nalert(\"done\");][chrome://messenger/content/messenger.xul");
user_pref("keyconfig.main.xxx_key_NextPanel", "][S][][SwitchPaneFocus(event);][chrome://messenger/content/messenger.xul");
user_pref("keyconfig.main.xxx_key_NextTab", "shift][K][][var curtab = document.getElementById(\"tabmail\");\nvar tablen = curtab.tabInfo.length - 1;\nvar tabindex = curtab.tabContainer.selectedIndex;\ntabindex == tablen ? tabindex = 0 : tabindex++;\ncurtab.switchToTab(tabindex);][");
user_pref("keyconfig.main.xxx_key_PageDown", "!][][][goDoCommand('cmd_scrollPageDown');");
user_pref("keyconfig.main.xxx_key_PageUp", "][U][][goDoCommand('cmd_scrollPageUp');");
user_pref("keyconfig.main.xxx_key_PrevPanel", "shift][S][][SwitchPaneFocus(event);][chrome://messenger/content/messenger.xul");
user_pref("keyconfig.main.xxx_key_PrevTab", "shift][J][][var curtab = document.getElementById(\"tabmail\");\nvar tablen = curtab.tabInfo.length - 1;\nvar tabindex = curtab.tabContainer.selectedIndex;\ntabindex == 0 ? tabindex = tablen : tabindex--;\ncurtab.switchToTab(tabindex);][");
user_pref("keyconfig.main.xxx_key_ScrollBottom", "shift][G][][goDoCommand('cmd_scrollBottom');");
user_pref("keyconfig.main.xxx_key_ScrollLeft", "][H][][goDoCommand('cmd_scrollLeft');");
user_pref("keyconfig.main.xxx_key_ScrollLineDown", "][J][][goDoCommand('cmd_scrollLineDown');");
user_pref("keyconfig.main.xxx_key_ScrollLineUp", "][K][][goDoCommand('cmd_scrollLineUp');");
user_pref("keyconfig.main.xxx_key_ScrollRight", "][L][][goDoCommand('cmd_scrollRight');");
user_pref("keyconfig.main.xxx_key_ScrollTop", "][G][][goDoCommand('cmd_scrollTop');");
user_pref("keyconfig.main.xxx_key_SwitchPaneFocus(event);", "!][][");
user_pref("keyconfig.main.xxx_key_toggleOffline", "][O][][MailOfflineMgr.toggleOfflineStatus()][chrome://messenger/content/messenger.xul");


Of course you will need to install Dorando's excellent keyconfig extension first.

As others have, I would like to thank Dorando very much, and encourage him to submit
keyconfig to AMO. Now that they have added donate buttons perhaps you can have a
little financial gain for your work as well.

This has probably already been discussed, but could there be something like a keyconfig.js
in profiles so that drop in files could be distributed for custom key maps like the one I have
shared here? It would make keyconfig easier for novice users and there could be repositories
with various key maps.
Patu
Posts: 31
Joined: September 24th, 2008, 2:20 am

Prevent address bar dropdown list

Post by Patu »

I'm using keyconfig for a website that actually deactivates key commands. The way to actuate the keys is to press F6 or STRG+L first. That moves the cursor to the address bar and makes the website responsive to key commands. So far, so good. Here's the problem.

Whenever I press the ALT+up or ALT+down cursor movement keys - which are configured with keyconfig - it also brings up an undesired dropdown list with suggestions for the address bar (because I moved the cursor to the address bar first).

So, how can I prevent the address bar from opening its dropdown list? The easiest way is pressing the esc-key.

Then I thought I just put the esc-command at the end of my keyconfig script for the ALT+cursor movement keys to prevent the address bar from unfolding. According to keyconfig the esc-command is "BrowserStop();". But that obviously doesn't work. Contrary to the esc-key the esc-command has no impact on the dropdown list.

So, which command would either prevent the address bar from opening its dropdown list or else close an already unfolded dropdown list? Or thirdly: is there a command to execute the esc-key?
- - - - - - -
I know I could opt out for suggestions of the address bar in the Firefox settings. But I don't want to do that.
Post Reply