Hacker News new | past | comments | ask | show | jobs | submit login
Setting up a second keyboard for more shortcuts in Emacs (jordekang.tk)
112 points by yur3i__ on Aug 14, 2018 | hide | past | favorite | 52 comments



A little more complicated, but a lot more versatile.

I had a similar issue, where I wanted a large amount of extra keys for macros/hotkeys. I bought a planck kit from olkb (https://olkb.com/planck/) (which is just one of many keyboard kits that will run the QMK firmware (https://github.com/qmk/qmk_firmware)) built it and rewrote the keymap to output my special keys.

Later I went on to wire up a couple simple industrial style footswitches to a cheapo arduino pro micro clone and put qmk on there.

A few other interesting and smaller keyboard kits can be found from vendors like https://www.1upkeyboards.com/ (the sweet16 macropad/keypad) and https://keeb.io (the chocopad or just half of any of their "ortholinear" split keyboard pcbs.



Since jwz dislikes HN, most users will want to use this link instead:

http://archive.is/z8VCZ



Something I've been wondering and casually looking into: besides another whole keyboard, what other keypad-like layouts/devices are there? What I think I want is another row of F-keys above the ones that are there (I use these to switch between windows). Of course I now use a TKL, but never warmed up to the idea of using the numpad for this. I think part of me just doesn't like the idea of repurposing keys with strong meanings.

I've pondered getting one of those pads used to drive music software. The Elgato Stream Deck mentioned elsewhere in this thread seems quite interesting (to look into when I have more time). Any other pointers?

Also related: I'd really like to try a wireless chorded keyboard for mobile use.


X-Keys makes a variety of USB key pads in various shapes, including single rows of 4, 8, or 16 keys.

http://xkeys.com/XkeysKeyboards/index.php


Also see Genovation

https://www.genovation.com


Building your own keyboard is actually very easy. There is some open source firmware out there that can run an arduino pro-micro's (and teesy 2.x) and clones. (https://github.com/qmk/qmk_firmware)

Search above in another comment by me and find a few vendors for keyboard kits that run qmk firmware...


I've actually got a drawer full of MX browns (ordered to fix the girlfriend's Das, but it ended up being a bad trace), and a stainless plate (probably not the best material or starting form, but I was already ordering some for a 3D printer). Just no time right now!


I highly recommend getting a controlpad if you want specially binded keys for macros.

This is what I use personally

https://www.amazon.com/gp/product/B00O1ASXKO/ref=oh_aui_sear...

I have it binded on windows, to keys that are not on the keyboard. F13,F14....F24 & modifiers CTRL, SHIFT,ALT etc with my own left-to-right and top-to-down naming convention. This makes it easier to manage what my macros are overall

Then I run a seperate program, if you run macOS, this would be applescript, or something easier like automator / keyboard maestro. Phrase express works as well.

- For windows, I use phrase-express to work off these keys

- Linux IDK what they use here unfortunately

The macropad I linked uses internal memory for saving for what keys you bind to it. Its way better than the alternative xkeys IMO and better cost. One reason why I say this is because genovationPad keys have more of a cherry MXbrown key feel to it, whereas xkeys feels very awkward on my fingers. Xkey's response rate on the key-up process was very slow and tedious IMO.

I backup all my genovationPad docs on a dropbox folder. The documentation is not the greatest even with youtube, their website, any docs I could find etc. But I gave them a phone call, and the tech guy over there was super helpful. I gave them feedback too on future improvements and they took it seriously.

Also, printing out my own picture icons on genovationPad was WAY easier to deal with than Xkeys. Its just a microsoft word doc, dump an image, print it out, slide it in the cap, done. I think they even included this doc right in the CD it came with.

Xkeys required extra accessories as well, I tested both for a good week before returning xkeys

Other things that may interest you - You can look into foot pedals use for racing games as a form of input control. This would be binded on a keyboard key as well IIRC, for windows I use F13

As a side note, I also use my genovationPad as my todo-list stickynote tracker. I just shove a bunch of stickynotes inbetween each row of keys. The rows in the back are low priority, the ones up front that get in the way are high priority.

The only keys I really use on a daily basis on windows are these:

- WIN + ←

- WIN + →

- WIN + ↑

- WIN + ↓

Mostly for resizing things around my triple monitor setup quickly


> I've pondered getting one of those pads used to drive music software

Audio controlers for Lightroom: https://www.youtube.com/watch?v=t5pwbY3_-Ek


> What I think I want is another row of F-keys above the ones that are there

You mean something like this keyboard from long ago:

http://www.northgate-keyboard-repair.com/ultra.jpg

Note the left side rows and above the QWERTY area.

That top row can be configured to send just F-keys, or Shift+Fkey, Control+Fkey, or Alt+Fkey. It defaults to Shift+Fkey.

Very good keyboard (source: typing this on one of the exact model pictured at that URL), somewhat hard to find now that it has been out of production for about 20 years.


That's close to what the old (really old?) Sun workstation keyboards looked like. I believe the keys on the left were L1-L10, and there were things like L1-A to get into hardware modes.

I believe there were some old terminal keyboards that also had a second row of function keys, F13-24, but it's been a long time since I saw one of those.


I use an Ergodox Infinity which has 'layers'. All keys are programmable and you assign keys to toggle/activate a layer. Its essentially extra shift keys - one layer turns my whole keyboard to symbols and another makes the home position for my right hand a num pad without having to move my hand. Pretty slick once you have it setup and get used to it, takes a lot of work to get there though.


> All keys are programmable and you assign keys to toggle/activate a layer.

Hmm, it's possible to do this with any keyboard. Find a key that you never/hardly use and bind that to running the command which toggles the layout.

Thanks for the inspiration.


CapsLock is a good candidate...

I wrote some Windows software to do this a few years back:

http://stickshift.cubicle6.com


You might dig something like this: http://www.twindata.com/affirmative/1229U.htm


You could get a terminal Model M or Model F, the 122 key kind.


A second keyboard is also good for playing split-screen multiplayer DOS games. No more incessant beeping in Mortal Kombat when both of you try to perform a combo at the same time!


Actually, a sane keyboard with sufficient rollover suffices for that task. Just don't but a <20$ model to get this.


I mean, if a piano (or something closer to a Tonnetz[0] layout) is okay, why not a full organ with >1 keyboard and pedals? :)

[0]: https://en.wikipedia.org/wiki/Tonnetz


I've seriously considered getting some sort of foot pedal arrangement, albeit mostly for FPS games - I'd love to be able to use one foot to melee attack, and another to activate/deactivate the mic.


I’ve tried repurposing a three-button guitar footpedal for FPS games before.

The connection for the pedal is TRS, with one button being ring, another sleeve, and the last both—so it ended up being useful for only two commands as the last button would be ghosted by pushing the other two simultaneously.

I used the pedal for left and right leaning and with melee in the center, but with the ghosting, I ended up dropping melee and just stuck with using it for only leaning.

I used an Arduino Pro Micro which supports acting as a keyboard and just soldered a TRS socket so I could just use a regular TRS cable to hook up the footpedal.

It’s a bit satisfying once you get it working and the project didn’t cost too much—maybe about $20 (found a cheap used footpedal) and enough games use “q” and “e” binds that I get to use it a bit.


They need a kick animation.


If you need a second keyboard to use your text editor, maybe the problem is not the keyboard, but the text editor.

yes emacs is more than that, but with f1-f12, ctrl,shift,alt and their various combinations to the alphanumeric keys, it seems a bit overkill to me.

If you still need more keys, you can also get a JP keyboard with extra modifiers conveniently located next to the spacebar.


Is it possible to do this on Mac? Have a second, external keyboard mapped to a different language than the primary keyboard?


With lua + autohotkey scripts in windows this is definitely possible the last time I checked. You run a luascript on another keyboard mapped to a generic key, luascript inputs that as the proper text-based language

There's a tomscott video on it

https://www.youtube.com/watch?v=lIFE7h3m40U

Checkout Teran van Hemert (linustechtips editor) for some potential ideas too. He's got crazy macro schemas, I've used a couple of his and there great. All windows based as well though. https://www.youtube.com/playlist?list=PLH1gH0v9E3ruYrNyRbHhD...

Mac, I can only assume its something you would write in applescript. But maybe you find some interesting ideas there. I found something called "http://www.orderedbytes.com/controllermate/" that might be of interest to you



You could use Karabiner[1]. No need to do the “different language” hack, just make a big pile of key remappings that only affect that particular keyboard. It’s pretty easy to target just one input device with that.

1: https://pqrs.org/osx/karabiner/


Heh, his feels like what happens when an Emacs user gets mocked by the vi crowd and decides to just own it. Good for him.


I though emacs/vi users don't want to take their fingers off the home row?


True for me. Using spacemacs which uses vi style keybindings, so most shortcuts are key sequences instead of chords. I think its faster for me to press two or three characters on the keyboard my fingers are already on before I move them into place on another keyboard.

Adding a second keyboard and using the Russian layout is a cool method to use a 2nd keyboard that doesn't just duplicate the keys of the first, and likely has more fun applications than just adding more shortcuts to your text editor.


There's also "key-chord-mode" which lets you bind any function to any two keys pressed in unison (or right after each-other) [1]. IIRC it's built-in to all modern versions.

[1] https://www.emacswiki.org/emacs/KeyChord

I'm trying to build out more ergonomic bindings since emacs-pinky is starting to haunt me at times. I have key-chords setup for very common things like jump to beginning/end of line ('jk' and 'kl').


That's definitely true for vi; but only after you properly remap your ESC key to something else (usually jj or caps lock).

Emacs is a differenet story... By default it uses a lot of alt and ctrl key combinations and also makes heavy usage of the arrow and home/end keys. Of course, there is a vi mode for emacs (evil; this is what Spacemacs uses) to take advantage of vi keys in emacs. But I believe that most emacs users just stick to the alt/ctrl shortcuts.


Ctrl and alt only take the little fingers. I'm actually used to not typing with them, but instead reserve them for shift, ctrl and alt. All the other fingers stay at their place.

After seeing the article I've thought about doing something similar, but dismissed it exactly because it would take my hands out of the keyboard.


I mix and match vi (evil) and normal emacs commands, choosing what's best for the case and for me. Some commands are so ingrained (C-a and C-e for navigating for instance) and convenient as they are that I just remapped them to be available in all modes


The arrows are duplicates of control P, N, B, F and the home and end keys control A and E.

Control is more common than Alt, and with the usual swap with caps lock (as on old keyboards) it is still on the home row for the left hand.


Double bucky, an additional keyboard or two...

(see: http://www.art.net/~hopkins/Don/text/double-bucky.html)


Three modifiers are enough: Command, option, control. Easy on macOS, possible on Linux:

    (setq mac-control-modifier 'super)
    (setq mac-option-modifier 'meta)
    (setq mac-command-modifier 'control)

I never have to resort to using two modifiers at the same time (e.g. Command + Option), as said 3 individual modifiers are plenty.

I also never use C-c or C-u prefixes, or other emacs-isms. Everything is a single combination, which is fundamentally simpler and more ergonomic.

For rarely-used commands, I just `M-x the-command`. Better than assigning complicated or easy-to-forget shortcuts.


Don't forget about the hyper key!

  (setq mac-function-modifier 'hyper)


so you rebind lots of key chords?


These are (almost) all of them, I'd say it's a bearable amount:

https://github.com/vemv/.emacs.d/blob/master/lib/non-submodu...

(also some are redundantly rebound, like left-key to left-char. I do it for... reasons)


Does Emacs distinguish between "left" and "right" modifiers? If so, you could (ab)use those to effectively create 4 extra prefix layers.


Another idea to consider, something like the Elgato Stream Deck (LCD keyboard where you can configure the image and behavior of every key).


Wow, those LCD keys are fancy, but it's hard to imagine that's worth the premium over a usb or BT 10-key. Not sure about other platforms, but on macOS with something like Karabiner-elements[1] or Controllermate[2] you could assign all sorts of things to those keys.

1: https://github.com/tekezo/Karabiner-Elements

2: https://www.orderedbytes.com/controllermate/


I find them useful in a slightly different use case. For things where you don't use them often enough to learn the shortcut by heart (i.e. you don't need the visual help) but often enough that it is worth having a button for it. For instance something you will be doing intensely for a short period of the time in the year.


Is it possible to have the 2 keyboards plugged in with different layouts in windows?


Haha, gloriously hacky.


very nerdy.


soon emacs-organ


Hmmm, with pull-stops to activate various minor modes...


Jokes write themselves /s




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: