keyconfig 20110522

Announce and Discuss the Latest Theme and Extension Releases.
Post Reply
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

keyconfig 20110522

Post by dorando »

keyconfig allows you to change keyboard shortcuts. [Firefox, Thunderbird, SeaMonkey, and any other XULRunner Application]

keyconfig adds the ability to create new or modify existing shortcuts defined by a <key> element, but only changing those which itself call a function (those with a command or oncommand attribute) has an effect (all others fulfill only cosmetic purposes it seems and are grayed out).

The configuration screen can be accessed via Tools > Keyconfig (in most Applications), the Add-ons Manager, or Ctrl+Shift+F12 (Command+Shift+F12 on MacOS) from the main window.

Currently there is only one list of modified keys per application, so changing a shortcut in one window will also affect other windows if they use the same key name.

Notes:
- All shortcuts listed (except Keyconfig…) are provided by the Application and other extensions, not by keyconfig.
- keyconfig should be able to recognize any keys usable by Gecko
- Don't think that changing a <key> will always remove the original shortcuts. For Example: You can change the shortcut for Copy in the Bookmarks Manager but the original shortcut will still work (in addition to the new shortcut).
- It is possible that keyconfig handles modifiers wrong.
- Any '][' in the code of user defined keys will be replaced by '] [' (which should have the same effect in most cases) since the pref separator is ']['.
- Disabled <key>s are removed from their <keyset> under the assumption that this has no drawbacks.
- Default modifiers can be set by changing ui.key.* prefs in about:config.
- Assigning the Control modifier to a shortcut attached to a menuitem on Mac doesn't work due to bug 519496
- The window-mediator returns an empty title for some recycled Thunderbird Compose windows
- Builds before 1.9.1 require restart after changing shortcuts
- All-In-One Sidebar, FoxyTunes, Click2Tab, Penelope, and Firebug base some of their code on keyconfig.

Other shortcuts:
- URL Suffix: URL ctrl/shift/ctrl+shift behavior
- Keyfixer: platformHTMLBindings.xml [Mac]
- SEARCHHOTKEYS: Find As You Type Link (') and Find As You Type Text (/)
- KeySnail: Key sequences, Emacs behavior
- Vimperator: Vim behavior
- MenuManipulator: Menu accesskeys

Configurations:

Code: Select all

prefs.js: (use about:config to edit these)

// Display internal shortcut
user_pref("keyconfig.devmode", true);

// Reverse the order in which submenu names are used, defaults are:
// Thunderbird       "Menu > Menuitem"
// Others            "Menuitem [Menu]"
user_pref("keyconfig.nicenames.reverse_order", true);

// Use another keyconfig profile, can be used to temporary disable all keys
user_pref("keyconfig.profile", "1");

// Disables the warning if an already used key was entered
user_pref("keyconfig.warnOnDuplicate", false);

// Don't wait for additional key stroke, jump immediately to the Apply butten
user_pref("keyconfig.allowAltCodes", false);

// Code which will be run in every window (only if non empty)
user_pref("keyconfig.global.20110323", "Module('UIHook');");

// Module('UIHook'); adds a key to all windows matching this pref
user_pref("keyconfig.UIHook","");

// Hide disabled <key>s in the keyconfig window
user_pref("keyconfig.hideDisabled", true);

userChrome.css:

/* Style different types of keys differently */
#keyconfig-window treechildren::-moz-tree-cell-text(hardcoded) { color: GrayText; }
#keyconfig-window treechildren::-moz-tree-cell-text(disabled) { text-decoration: line-through; }
#keyconfig-window treechildren::-moz-tree-cell-text(user) { font-weight: bold; }
#keyconfig-window treechildren::-moz-tree-cell-text(duplicate) { background-color: rgb(80%, 80%, 80%) !important; color: inherit !important; }
#keyconfig-window treechildren::-moz-tree-cell-text(custom) { font-style: italic; }

Example custom keys.

Changes:
20110522:
- Made keyconfig not depend on other extensions adding the corresponding <command>s for their <key>s
- Checks now also for <broadcaster>s to determine if the <key> has any code
- Made Module('UIHook'); also pass the current window to keyconfig
- Adjusted some translations
- Added keyconfig.hideDisabled pref
- Default disabled <key>s now receive the correct cell property
- The rows have now also receive properties

20110323:
- Added support for Toolkit 2.0 Applications and dropped support for pre Toolkit 1.9
- Added da-DK by Jørgen Rasmussen
- Some changes due the new XPCOM components registration.
- Check browser.backspace_action if cmd_handleBackspace/cmd_handleShiftBackspace should be mapped to goBackKb/goForwardKb
- Should now work from tab ( chrome://keyconfig/content/ )
- Added the keyconfig dialog as the optionsURL as many searched for it in the Add-ons Manager
- Focused duplicates will now use inverted colors
- Using the a key name multiple times should work now
- Space will now be displayed as <VK_SPACE>
- Disabled shortcuts will now be displayed as <Disabled>
- Disabled shortcuts will not anymore be removed from the document, just from the <keyset> (and added to a <keyconfig> element) since that caused problems with some shortcuts (key_toggleMessagePane, key_errorConsole)
- The shortcut box will now be focused after adding a new key
- Removed all targetApplication from install.rdf except the Mozilla Toolkit
- All ][ should now be changed to ] [ (previously only the first was changed)
- Changed all <popup> to <menupopup>
- Modified the overlay to add a new <keyset> and <commandset> instead of using built-in as that could cause a duplicated shortcut in some Applications.
- The <keyset> will now always be detached/reattached on Apply/Disable (the keyconfig.tryToInvalidateCache has been removed)
- The keytext of a modified <key> will now also be removed
- Changes are applied to all open windows immediately
- Removed keyconfig.warnOnClose since that warning is gone
- Changed from uncompressed files inside jar and compressed jar to compressed files inside jar and uncompressed jar according to new Firefox recommendation

Older Changes.
Last edited by dorando on May 22nd, 2011, 5:00 am, edited 35 times in total.
Support mozilla.dorando.at through donations/contributions.
User avatar
Rowne Mastaile
Posts: 1434
Joined: December 21st, 2003, 3:05 pm
Location: Housed in a swirling neosma of scintillating thought and turgid ideas.
Contact:

Post by Rowne Mastaile »

You have my most sincere thanks, Dorando. I'm wholly impressed with this. When you have a lot of extensions, being able to alter the keys is a boon but simply being able to know all the keys without looking at the docs is an absolute... well, it's handy. I'll say that.

I have quite a few <cough> extensions installed here and merely keeping track of the shortcuts sometimes is a pain in the arse. Now I can just Ctrl+Shift+12 and find out! So now I can clear my 'Tab 3' of QuickNotes and use it for something else other than shortcut reminders. ^.^

Just a minor suggestion: You mentioned keys that appear to be merely affectatious, like Undo Close Tab in Tabbrowser Extensions. Could you include those keys anyway and grey them out as unchangeables? Having every hotkey set in one place would be fantastic, simply grey out the ones that can't be changed and you have... something that should really come with Firefox itself, there.

Nonetheless, even as is, this is absolutely bloody perfect. Way to go! <cheer, flag>
sparkyz
Posts: 85
Joined: May 28th, 2003, 8:03 pm
Contact:

Post by sparkyz »

I'm pretty confused on how to work this here, where/what do I configure?

Does it not work on the OS X versions of FF/TB?
User avatar
Rowne Mastaile
Posts: 1434
Joined: December 21st, 2003, 3:05 pm
Location: Housed in a swirling neosma of scintillating thought and turgid ideas.
Contact:

Post by Rowne Mastaile »

Try pressing Command+Shift+F12 after the extension has successfully installed.
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Post by dorando »

There should also be a Tools->Keyconfig... available.

Roan Foofitush wrote:Could you include those keys anyway and grey them out as unchangeables?

Good idea, should be in next update. I'm currently trying to find a way to do this without adding a skin.
Support mozilla.dorando.at through donations/contributions.
velcrospud
Posts: 506
Joined: January 27th, 2003, 4:00 am
Contact:

Post by velcrospud »

Nice work. This was defenitely a needed extension.

Only one thing, I would rather the extension's options dialog be used, instead of adding a menu item to the tools menu, but I suppose I can live with it.
User avatar
MonkeeSage
Posts: 1011
Joined: December 20th, 2002, 8:15 pm

Post by MonkeeSage »

dorando wrote:Good idea, should be in next update. I'm currently trying to find a way to do this without adding a skin.


To make a menu item disabled (grayed out, unclickable) use <code>element.setAttribute('disabled', true)</code>, e.g., <code>document.getElementById('dead-menu-item').setAttribute('disabled', true)</code> (or did I misunderstand what you meant?).

BTW, awsome extension! :)


Shelumi`El
Jordan

S.D.G
"[M]en are usually satisfied with bad argument only when their convictions rest on other grounds." --John Oman
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Post by dorando »

Thanks MonkeeSage but I need it for a treecell and it doesn't seem to work there (neither seems there to be a default style for <code>properties="disabled"</code> or something like that)...

velcrospud wrote:Only one thing, I would rather the extension's options dialog be used, instead of adding a menu item to the tools menu, but I suppose I can live with it.

Would be a bit problematic as keyconfig needs to access the window, which might not be possible in some situations (or not at all, I havn't tested it).
User avatar
Rowne Mastaile
Posts: 1434
Joined: December 21st, 2003, 3:05 pm
Location: Housed in a swirling neosma of scintillating thought and turgid ideas.
Contact:

Post by Rowne Mastaile »

Dorando: as a suggestion you could put an option in the extension to simply have it accessible via hotkey only (like some of Magpie's dialogs) and thusly to remove the Tools menu option. Not something I'd want, I like it as is but... if that's desired that might be the way to do it, having a hotkey-only-access option or such. Would that work?
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Post by dorando »

Adding

Code: Select all

menuitem#keyconfig { display:none }
to your userChrome.css should do it.
sparkyz
Posts: 85
Joined: May 28th, 2003, 8:03 pm
Contact:

Post by sparkyz »

Hey Dorando, after figuring out how to use this, I'm definitely going to have to call it an absolutely essential extension for me. Thanks for the great bit of work!
User avatar
MonkeeSage
Posts: 1011
Joined: December 20th, 2002, 8:15 pm

Post by MonkeeSage »

dorando:

OK, yeah I totally misunderstood. On looking at the code I see what you're trying to do now. I'm posting some changes to you in PM to disable the entry boxes when you select a 'disabled' (properties=disable) tree row and a few other minor changes. Hope it helps. Thanks again for a great extension!


Shelumi`El
Jordan

S.D.G
"[M]en are usually satisfied with bad argument only when their convictions rest on other grounds." --John Oman
sbushey
Posts: 11
Joined: April 30th, 2004, 7:27 pm

Post by sbushey »

So is it possible for tab commands such as "select the tab to the left" "close tab", and "close other tabs" to get key commands?

Where could I get a tutorial to learn to make my own extensions?
User avatar
PGMario
Posts: 31
Joined: March 23rd, 2004, 4:09 pm

Post by PGMario »

This is awesome! I wanted to learn how to create extensions just to do something like this! Combined with SuperScroll and the "Find As You Type" function (or whatever it's called) it makes my ibook's trackpad -almost- obsolete for browsing. Thanks a lot!
bdwelle
Posts: 30
Joined: September 21st, 2003, 8:40 am

Post by bdwelle »

This is the start of what I'm looking for, thanks dorando. I am trying to use keyconfig to set up "z" and "x" like Opera -- or at least "Ctrl Z" and "Ctrl X". The single-key shortcuts show up as "+z" and "+x" -- and firefox kindof goes haywire... If I do "accel+z" and "accel+x", Ctrl Z works for back, but Fwd seems to act a bit strange - it doesn't move through the page stack correctly.
Post Reply