Thanks to everyone answering questions.
chirpy_7 wrote:For about 1 week or 2 I've noticed that occasionally (and so far unpredictably) the single-stroke keyconfig keys stop working (until I restart FF).
Sadly no idea what could cause that, nor how to diagnose it. Note that the Application does the handling, not keyconfig.
OlegYch wrote:i have a problem with it though - if i add or change shorctut to e.g. ctrl-alt-z and switch keyboard layout to russian the shortcut stops working (unless i also add ctrl-alt-я shortcut - я is at the same key as z on russian keyboards)
can this be fixed?
Since the application does all shortcut handling, the only way would be to add multiple shortcuts.
Note that the application actually
uses the ASCII/Latin equivalents if either Ctrl or Alt is pressed (but not if
both are pressed) and actually uses it as the default for
Ctrl.
OlegYch wrote:When I add ctrl-alt-я shortcut all hell breaks loose - e.g. firefox starts trying to bookmark current page when i press tab or escape.
Doesn't seem to happen for me (Russian Firefox with Russian layout), maybe another extension interferes?
Miccovin wrote:is it possible to deactivate a key at a special site?
For example lets get the simple "script" to scroll up 1 line:
But the key for this should be automatically deactivated on a special site, maybe on forums.mozillazine.org.
Try
Code: Select all
if(content.location.host != "forums.mozillazine.org") {
goDoCommand('cmd_scrollLineUp');
}
https://developer.mozilla.org/docs/Web/API/Locationsashabe wrote:I use Checkvist service for tasks, and it allows you to manipulate the tasks from keyboard.
Currently I use this code to load Checkvist page into a sidebar and then try to focus its contents, but focus doesn't seem to settle in the right place:
Code: Select all
var sidebar_box = document.getElementById('sidebar-box');
if(sidebar_box.hidden) {openWebPanel("Checkvist","http://checkvist.com/iframe.html");
gURLBar.focus();
for (var i = 0; i<4; i++) {
window.setTimeout(function() {
commandDispatcher.advanceFocus();
}, 200);
}
}
else {toggleSidebar();}
Try
Code: Select all
var sidebar_box = document.getElementById('sidebar-box');
if(sidebar_box.hidden) {
openWebPanel("Checkvist","http://checkvist.com/iframe.html");
var sidebar = document.getElementById("sidebar");
sidebar.addEventListener("load", function tempFunction(event) {
sidebar.removeEventListener("load", tempFunction, true);
var webPanelsBrowser = event.target.getElementById("web-panels-browser");
webPanelsBrowser.addEventListener("load", function tempFunction(event) {
webPanelsBrowser.removeEventListener("load", tempFunction, true);
event.target.defaultView.setTimeout(function() {
gURLBar.focus();
for (var i = 0; i<4; i++) {
commandDispatcher.advanceFocus();
}
}, 0);
}, true);
}, true);
} else {
toggleSidebar();
}
bege wrote:dorando wrote:Try
Code: Select all
ChangeLanguage({ target: { value: "en-US" }, __noSuchMethod__: function() { } });
It doesn't work here
What can I try to make it work?
Windows 7 Professional 64 bit
FF 23.0.1
Try
Code: Select all
var dictionary = "en-US";
var Cc = Components.classes; var Ci = Components.interfaces;
Cc['@mozilla.org/spellchecker/engine;1'].getService(Ci.mozISpellCheckingEngine).dictionary = dictionary;
var nsIContentPrefService2 = Cc["@mozilla.org/content-pref/service;1"].getService(Ci.nsIContentPrefService2);
var target = document.commandDispatcher.focusedWindow;
if(target == window) target = content;
var loadContext = target.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsILoadContext);
nsIContentPrefService2.set(target.location, "spellcheck.lang", dictionary, loadContext);
Services.prefs.setCharPref("spellchecker.dictionary", dictionary);
Note that spell check settings are remembered per site since
Bug 678842.
ddong wrote:Hello, i'm trying to change the next/previous tab group keyboard shortcut. So i ended up downloading this extension. However, even after long searching, i couldn't find the code related to these actions.
You can't change those shortcuts (due to the way they are defined/handled), but for new shortcuts try:
Code: Select all
TabView._initFrame(function() {
var groupItems = TabView._window.GroupItems;
var tabItem = groupItems.getNextGroupItemTab(true);
if (!tabItem)
return;
if (gBrowser.selectedTab.pinned)
groupItems.updateActiveGroupItemAndTabBar(tabItem, {dontSetActiveTabInGroup: true});
else
gBrowser.selectedTab = tabItem.tab;
});
and
Code: Select all
TabView._initFrame(function() {
var groupItems = TabView._window.GroupItems;
var tabItem = groupItems.getNextGroupItemTab(false);
if (!tabItem)
return;
if (gBrowser.selectedTab.pinned)
groupItems.updateActiveGroupItemAndTabBar(tabItem, {dontSetActiveTabInGroup: true});
else
gBrowser.selectedTab = tabItem.tab;
});
which matches the original
code.
Alternatively you can try to invoke the original handler with:
Code: Select all
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendKeyEvent("keypress", 0, "`".charCodeAt(0), Event.CONTROL_MASK);
and
Code: Select all
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendKeyEvent("keypress", 0, "`".charCodeAt(0), Event.CONTROL_MASK | Event.SHIFT_MASK);
Allasso wrote:I am using Mac, I have observed that when changing to a keybinding which uses the Alt key, when typed into the textbox, the character is translated into a special character. So if I type say, "Alt + S", it enters only ß (does not show Alt symbol). I would expect this behavior in the textbox, since that is what Macs do by default when using the Alt key. However, apparently because of this, keyconfig is not recognizing it as "Alt + S", and so there is no mapping done, and the command does not work. I can put the code <key key="S" modifiers="alt" command="some_command"/> into an overlay and it will work, so I know that that combination is valid on Mac. It is just that I cannot assign it to that using keyconfig.
If, however, the Alt key is combined with another modifier, eg, "Alt + Cmd + S", then "<Alt symbol><Cmd symbol>ß" appears in the textbox. I can assign it, and it will work, however, from then on, "<Alt symbol><Cmd symbol>ß" (with the special character) is what will always appear in the keybinding list.
Sounds like
Bug 308565 - event.altKey is always false for onkeypress on Mac (I wonder if
getModifierState has the same behavior). Since Alt+S works for the overlay, changing the modifier through about:config for a shortcut should also work.
Allasso wrote:I get this error when I open keyconfig in FF 26:
JavaScript error: chrome://keyconfig/content/keyconfig.js, line 419: props is undefined
JavaScript error: chrome://keyconfig/content/keyconfig.js, line 424: props is undefined
Thanks for reporting, will be fixed in the next release.
mantra wrote:may i know where can find the list of command/id , the code ?
Check the
Mozilla Developer Network or
Mozilla Cross-Reference or use
DOM Inspector or the
Web Console.
Springtime wrote:Also, as this is the right thread for it: I'd like to suggest the ability in Firefox/keyconfig to add mnemonic keyboard shortcuts.
For example: by creating the shortcut "p,i,n" (p followed by i followed by n) one could toggle Pinning a tab. It's an incredibly useful feature Opera 12 has as a side-effect of being able to manually enter shortcut commands by typing them out. Naturally they are disabled while a textbox is focused.
You might be interested in
KeySnail. With keyconfig you could try something like:
Code: Select all
var buffer = "p";
XULBrowserWindow.statusTextField.label = buffer;
window.addEventListener("keypress", function tempFunction(event) {
var modifiers = ["Alt","Control","Meta","Shift","OS"]
.filter(function(val, i, obj){ return event.getModifierState(val); }).join(" ");
if(modifiers)
buffer = null;
else
buffer += String.fromCharCode(event.charCode)
var finished = false;
switch(buffer) {
case "pi" : event.stopPropagation(); event.preventDefault(); break;
case "pin": event.stopPropagation(); event.preventDefault();
if(gBrowser.selectedTab.pinned)
gBrowser.unpinTab(gBrowser.selectedTab);
else
gBrowser.pinTab(gBrowser.selectedTab);
finished = true;
break;
default:
finished = true;
}
if(finished) {
window.removeEventListener("keypress", tempFunction, true);
XULBrowserWindow.statusText = null;
XULBrowserWindow.updateStatusField();
} else {
XULBrowserWindow.statusTextField.label = buffer;
}
}, true);
and assign
p to it.
avada wrote:Anyone knows a workaround for the super annoying "alt gr" (or "ctrl+alt", apparently they're the same) bug?
I can use some characters like "H" with this prefix without issue. Others get the secondary character for that key, so they don't work in a textfield. (I guess there's no way around this.) "i" and "j" changes to "í" with this prefix. Which is a different key on the keyboard, so I can't use them.
You could try
Customizable Shortcuts,
Custom Buttons, or other Add-ons using event listeners to handle the shortcuts directly (keyconfig doesn't handle shortcuts at all, the Application does it).
avada wrote:But with "L" I get nothing I get the "Ł" character for the hotkey but it doesn't react at all. It works for altgr+"k" though which brings up the same character in the settings.
Using
Hungarian Keyboard Layout or
Hungarian 101-key Keyboard Layout both seem to work for me (they do appear the same because they get converted to uppercase before displaying/handling).
Caspid wrote:Is there a way to switch back to the last-selected tab (without altering the about:config pref)?
Try
Code: Select all
var lastAccessed = 0;
var lastTab = gBrowser.selectedTab;
for(tab of gBrowser.visibleTabs) {
if(tab.lastAccessed > lastAccessed && gBrowser.selectedTab != tab) {
lastAccessed = tab.lastAccessed;
lastTab = tab;
}
}
gBrowser.selectedTab = lastTab;
mward wrote:but there is one feature I miss. With kmail I can hit "m" and get a menu of all folders: clicking on a folder moves the email to that folder.
Try to Add a new key containing:
Code: Select all
var allFolders = MailServices.accounts.allFolders.enumerate();
var folders = [];
while(allFolders.hasMoreElements()) {
var folder = allFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
if(folder.canFileMessages)
folders.push(folder);
}
folders.sort(function(a, b) {
return (a.prettiestName + " - " + a.parent.prettiestName) > (b.prettiestName + " - " + b.parent.prettiestName);
});
var tempMenu = document.createElement("menupopup");
for(folder of folders) {
var menuitem = document.createElement("menuitem");
menuitem.setAttribute("label", folder.prettiestName + " - " + folder.parent.prettiestName);
menuitem.setAttribute("class", "folderMenuItem menuitem-iconic");
menuitem.setAttribute("SpecialFolder", getSpecialFolderString(folder));
menuitem.setAttribute("IsSecure", folder.server.isSecure);
menuitem.setAttribute("ServerType", folder.server.type);
menuitem._folder = folder;
tempMenu.appendChild(menuitem);
}
document.documentElement.appendChild(tempMenu);
tempMenu.openPopup(null, "after_start", 0, 0, true, false, event);
var listener = {
handleEvent: function(event) {
switch(event.type) {
case "command":
MsgMoveMessage(event.target._folder)
break;
case "popuphiding":
if(event.eventPhase != event.AT_TARGET)
return;
break;
}
tempMenu.removeEventListener("command", listener, false);
tempMenu.removeEventListener("popuphiding", listener, false);
document.documentElement.removeChild(tempMenu);
}
}
tempMenu.addEventListener("command", listener, false);
tempMenu.addEventListener("popuphiding", listener, false);