MozillaZine

keyconfig 20080929

Announce and Discuss the Latest Theme and Extension Releases.
dorando
 
Posts: 946
Joined: January 9th, 2004, 9:57 am
April 30th, 2004, 3:18 am

Post Posted April 30th, 2004, 3:18 am

keyconfig allows you to change keyboard shortcuts. [Firefox, Thunderbird, Sunbird, Flock, ChatZilla on XULRunner, and Toolkit 1.9 Applications (Prism, Songbird, McCoy, the upcoming SeaMonkey 2.0, ...)]

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) 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 the the document under the assumption that this has no drawbacks.
- It is currently not possible to have the same user defined key in multiple windows without making it global.
- Some users might be interested in functions for keyconfig.
- Default modifiers can be set by changing ui.key.* prefs in about:config.
- URL Suffix allows to edit the URL ctrl/shift/ctrl+shift behavior.
- All-In-One Sidebar, FoxyTunes, Click2Tab, and Penelope base some on their code on keyconfig.

Configurations:
Code: Select all
prefs.js:

// 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 you close the window
user_pref("keyconfig.warnOnClose", false);

// 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.20080611", "Module('UIHook');");

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

// Don't try to invalidate the key cache in case this causes problems
user_pref("keyconfig.tryToInvalidateCache", false);

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%); }
#keyconfig-window treechildren::-moz-tree-cell-text(custom) { font-style: italic; }

Example custom keys.

Changes:
20080929:
- Added zh-CN by Cye3s
- Shortcuts disabled as per bug 426501 also appear disabled in keyconfig now
- Minor workaround because Firefox 3.0.2 changed a "~10 year old behavior in a breaking way"
- Added keyconfig.tryToInvalidateCache pref which if enabled (is enabled by default) tries to invalidate the key cache by cloning the <key> and detaching/reattaching the <keyset> to the DOM (This might cause changes to apply immediately or after a short delay)

20080611:
- Added support for Toolkit 1.9 Applications and dropped support for pre Toolkit 1.8
- Moved one line of code to the Service Constructor since the app-startup observer doesn't seem to be called in Gecko 1.9 if addObserver has not been called before
- Minor change to the component to avoid a possible leak
- If you had the modified version by onemen installed previously, the keyconfig screen shouldn't fail anymore
- Using Alt Codes as shortcuts should now work again. Note that these won't work in text boxes. Set keyconfig.allowAltCodes to false if you want to use Alt+Number shortcuts.
- A global key (and a menuitem if MenuManipulator is installed) will be added to Applications needing it

Older Changes.
Last edited by dorando on September 30th, 2008, 7:43 am, edited 32 times in total.

Rowne Mastaile

User avatar
 
Posts: 1434
Joined: December 21st, 2003, 3:05 pm
Location: Housed in a swirling neosma of scintillating thought and turgid ideas.
April 30th, 2004, 4:26 am

Post Posted April 30th, 2004, 4:26 am

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
April 30th, 2004, 2:24 pm

Post Posted April 30th, 2004, 2:24 pm

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?
Такси в Петербурге.

Rowne Mastaile

User avatar
 
Posts: 1434
Joined: December 21st, 2003, 3:05 pm
Location: Housed in a swirling neosma of scintillating thought and turgid ideas.
April 30th, 2004, 3:36 pm

Post Posted April 30th, 2004, 3:36 pm

Try pressing Command+Shift+F12 after the extension has successfully installed.

dorando
 
Posts: 946
Joined: January 9th, 2004, 9:57 am
April 30th, 2004, 3:58 pm

Post Posted April 30th, 2004, 3:58 pm

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.

velcrospud
 
Posts: 503
Joined: January 27th, 2003, 4:00 am
April 30th, 2004, 4:59 pm

Post Posted April 30th, 2004, 4:59 pm

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.

MonkeeSage

User avatar
 
Posts: 1011
Joined: December 20th, 2002, 8:15 pm
April 30th, 2004, 10:31 pm

Post Posted April 30th, 2004, 10:31 pm

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: 946
Joined: January 9th, 2004, 9:57 am
May 1st, 2004, 3:23 am

Post Posted May 1st, 2004, 3:23 am

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).

Rowne Mastaile

User avatar
 
Posts: 1434
Joined: December 21st, 2003, 3:05 pm
Location: Housed in a swirling neosma of scintillating thought and turgid ideas.
May 1st, 2004, 5:29 am

Post Posted May 1st, 2004, 5:29 am

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: 946
Joined: January 9th, 2004, 9:57 am
May 1st, 2004, 5:41 am

Post Posted May 1st, 2004, 5:41 am

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
May 1st, 2004, 8:53 am

Post Posted May 1st, 2004, 8:53 am

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!
Такси в Петербурге.

MonkeeSage

User avatar
 
Posts: 1011
Joined: December 20th, 2002, 8:15 pm
May 1st, 2004, 2:10 pm

Post Posted May 1st, 2004, 2:10 pm

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
May 1st, 2004, 6:56 pm

Post Posted May 1st, 2004, 6:56 pm

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?

PGMario

User avatar
 
Posts: 31
Joined: March 23rd, 2004, 4:09 pm
May 4th, 2004, 1:45 pm

Post Posted May 4th, 2004, 1:45 pm

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
May 17th, 2004, 11:39 am

Post Posted May 17th, 2004, 11:39 am

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.

Return to Extension/Theme Releases


Who is online

Users browsing this forum: Google Feedfetcher, ridgedale and 18 guests