> We like making a lot of hotkey entries in Irush.
>
> Looks like we can define as many as we want and run them
> by clicking on Hotkeys -> [name of our command].
>
> But it seems for keyboard shortcuts, we're limited to the 12 function keys.
>
> Is there a way to define Ctrl-<functionkey> or Shift-<functionkey>
> in irush, so we can make use of more keyboard shortcuts?
Yes.
Although the menu in the Hotkey -> Edit is limited to F1 - F12,
you can manually hack the ~/.irushrc file to assign other key combos.
If you look in your ~/.irushrc file, there's a large numeric
value that represents the key code for the shortcut of each Hotkey command.
For instance, in my .irushrc file I have the F2 key
assigned to run a python script, eg:
name My LAC Report
command python /myserver/production/scripts/rush/my_lac_report.py
fkey 65471
output Upper:AllCpus
The 65471 in the above is irush key code for the F2 key.
You can logically OR this value with values for the different
Shift/Control/Alt/Meta keys, which are:
Shift -- 0x10000
Ctrl -- 0x40000
Alt -- 0x80000
Meta -- 0x400000
So the Ctrl-F2 key would be 65471 | 0x40000.
The following one-liner perl script tells us this is 327615:
$ perl -e 'printf("%d\n",65471|0x40000);'
327615 <--
So if I *close* all the irush windows first (because it saves
over the .irushrc on exit), then manually edit my .irushrc file
and change the 65471 value to 327615, eg:
name My LAC Report
command python /myserver/production/scripts/rush/my_lac_report.py
fkey 327615
output Upper:AllCpus
..Now when I open irush, I should see "Ctrl-F2" in the Hotkeys menu
as the shortcut, and can hit Ctrl-F2 to invoke the command.
Here's a quick table of the various shift key combos and their key codes:
F1: 65470 Shift-F1: 131006 Ctrl-F1: 327614 Alt-F1: 589758 Meta-F1: 4259774
F2: 65471 Shift-F2: 131007 Ctrl-F2: 327615 Alt-F2: 589759 Meta-F2: 4259775
F3: 65472 Shift-F3: 131008 Ctrl-F3: 327616 Alt-F3: 589760 Meta-F3: 4259776
F4: 65473 Shift-F4: 131009 Ctrl-F4: 327617 Alt-F4: 589761 Meta-F4: 4259777
F5: 65474 Shift-F5: 131010 Ctrl-F5: 327618 Alt-F5: 589762 Meta-F5: 4259778
F6: 65475 Shift-F6: 131011 Ctrl-F6: 327619 Alt-F6: 589763 Meta-F6: 4259779
F7: 65476 Shift-F7: 131012 Ctrl-F7: 327620 Alt-F7: 589764 Meta-F7: 4259780
F8: 65477 Shift-F8: 131013 Ctrl-F8: 327621 Alt-F8: 589765 Meta-F8: 4259781
F9: 65478 Shift-F9: 131014 Ctrl-F9: 327622 Alt-F9: 589766 Meta-F9: 4259782
F10: 65479 Shift-F10: 131015 Ctrl-F10: 327623 Alt-F10: 589767 Meta-F10: 4259783
F11: 65480 Shift-F11: 131016 Ctrl-F11: 327624 Alt-F11: 589768 Meta-F11: 4259784
F12: 65481 Shift-F12: 131017 Ctrl-F12: 327625 Alt-F12: 589769 Meta-F12: 4259785
..which was generated by the following one-liner perl script:
perl -e '$k=65470; for($f=1;$f<=12;$f++,$k++) { printf("F$f: %d\tShift-F$f: %d\tCtrl-F$f:%d\tAlt-F$f:%d\tMeta-F$f:%d\n",$k,$k|0x10000,$k|0x40000,$k|0x80000,$k|0x400000); }'
You can also get other combos like Ctrl-Shift-F1 the same way
by OR'ing several masks with the raw F-key codes.
Note that your window manager may use some of those codes
for itself, so you won't be able to use those. These vary
from one window manager to the other, so be wary.
This same technique works for the master rush/etc/.irushrc
file as well.
AFAIK, such modifications should remain in effect, and works
for all versions of Irush.
Other key codes are possible as well for /all/ the keys on the
keyboard. If that's desired, I can follow up with a more complete
list.
|