How to use multimedia keys on Komodo?


#1

I have a lot of keybinding for too many commands and scripts, I am looking for options to avoid long shortcuts like Ctrl+Alt+Shift+F4 or Ctrl+K, C, L, E, A, R (yes, I am using that sequence), so I am thinking on use the multimedia keys for debugging, lest say something like:

  • Play for Go/Continue debugging
  • Stop for stop debugging
  • Pause for… well… pause debugging
  • Fwd for runs to the end or next breakpoint

I tried assigned them but seems like komodo doesn’t listen these keys, so…

Is there any way to use these multimedia keys on komodo?

Thank you!


#2

This is a great question. I’ve never dug into that part of Komodo before. Looks like we can hack this in if you like though.

So this will add the appropriate keys to your prefs:

var _ = require("contrib/underscore");

var VKLabels = { "Volume_Down":"VK_VOLUME_DOWN",
    "Volume_Up":"VK_VOLUME_UP",
    "Volume_Mute":"VK_VOLUME_MUTE"};

var VKCodes = {0xB6: "Volume_Down",
0xB7: "Volume_Up",
0xB5: "Volume_Mute"};

_.extend(ko.keybindings.VKLabels, VKLabels);
_.extend(ko.keybindings.VKCodes, VKCodes);

Running that in a Userscript at start up would add them or you can copy/paste run it in the JS Console (View menu > Tabs & Sidebars > Console). Once you run the above, you SHOULD be able to hit the named keys in the keybindings prefs window, in the New Key Sequence field. I couldn’t figure out the play button as it didn’t seem to use a proper standard key on my keyboard.

I considered adding this to Komodo core but I don’t have time to test that it works on Linux, OSX and Windows, plus confirm that other keyboards don’t use other names/values (they shouldn’t…).

I figured this out by adding a few console.log() lines to https://github.com/Komodo/KomodoEdit/blob/master/src/chrome/komodo/content/keybindings/keybindings.p.js#L2622, if you feel like muck around more.

  • Carey

#3

Where can I find that keybindings.p.js file to try to find the play key?


#4

I suggest you build Komodo from source to play with it’s insides. To edit the installed version can you clarify which platform you’re on?


#5

Do you mean my operating system? I am on Windows 10.

Do you know any other way to get my media keys code?

reBuild komodo sounds risky, I don’t want to break anything :fearful:


#6

Now that you mention it, yes, just put a onkeypress function on window:
window.onkeypress = console.log

  • Carey