vikeys - terminal app for keymap editing (tmk/ergodox)

CJNE

07 Mar 2014, 23:08

I've been playing with a curses based terminal tool to edit keymap.h files in the tmk firmware and have reached a stage where it's almost useable :).
I wanted to see if anyone else would be interested in such a tool and/or have ideas for functionality?

Consider it an early alpha. I have only tested it on OS X using iTerm. Terminal.app should also work but mouse support wont work so well there. I have tried to think about Windows users but it hasn't been tested there.

Right now it only has support for the ErgoDox keyboard layout and loading/writing of tmk firmware header files but it should be easy to add support for other firmwares and keyboards if anyone is interested.
Loading and saving works, but right now you can't edit the action definitions.

If you try it, please make sure to back up your original .h file if you save with the same name, the tool will rewrite the file completely in a not so human friendly format.

More information can be found here:
https://github.com/CJNE/vikeys

Questions, comments and suggestions are welcome :)

Screenshot of it's current state:
vikeys
vikeys
vikeys.png (26.72 KiB) Viewed 1580 times

User avatar
damorgue

07 Mar 2014, 23:10

Looks neat. I believe a few have tried this in the past. Does it support macros, strings and more advanced layer functionality?

CJNE

07 Mar 2014, 23:15

Right now you can't edit actions, that's what i'm working on at the moment.
It will be possible to construct any kind of action, such as macros and all types of layer functionality. If you look at the screenshot you can see the list of actions that were parsed from the .h file, the plan is to make them editable and have a way to add/delete.

User avatar
scottc

07 Mar 2014, 23:33

Very interested! I can't test for Ergodox support but I'll play around with it and let you know how it goes.

CJNE

08 Mar 2014, 00:08

Great, thanks! What keyboard layout would you like to have?

User avatar
scottc

08 Mar 2014, 00:22

I'm going to be using TMK for a custom 65% at some point in the near future. The layout will be something like this except properly put together: Image

CJNE

08 Mar 2014, 00:30

I can add a layout for it when i get a chance, or you can do one and send to me :)
Here's how it's done: https://github.com/CJNE/vikeys/blob/mas ... yboards.js
Every number represents a key, null means blank space. The "resolution" needed depends on how many different key sizes you
have, and how accurately it should be displayed.

User avatar
Muirium
µ

08 Mar 2014, 00:32

I've thought of making something graphical like this to aid my cunning with Soarer's Converter and Controller. But then I remember I'm not a programmer. I like playing in Interface Builder, but then comes the hard part…

Anyway, good luck with this. Hasu's great library has me stumped, but there's great features in there looking for liberation into the hands of riffraff like me. Tap triggers and layer locks are the ones I'd really like to play with. I'm beginning to get into it with his ADB converter, but Soarer's was a faster learning experience for me.

User avatar
scottc

08 Mar 2014, 00:35

CJNE wrote:I can add a layout for it when i get a chance, or you can do one and send to me :)
Here's how it's done: https://github.com/CJNE/vikeys/blob/mas ... yboards.js
Every number represents a key, null means blank space. The "resolution" needed depends on how many different key sizes you
have, and how accurately it should be displayed.
I've been meaning to learn Node, so I might give it a try. :)

CJNE

08 Mar 2014, 00:39

I've been meaning to take a look at Soarers firmware but i haven't had the chance so far, it's something i'd like to add support for. But first i'll make it possible and easy to make use of all the functionality in TMK's action functions :)

I did consider a Cocoa app at first but i really like to do as much as possible in the terminal, and it is a nice challenge :)

User avatar
Muirium
µ

08 Mar 2014, 00:45

Soarer's uses NVRAM on the Teensy to store configuration, so you can edit on the fly. I think Hasu's requires a rebuild on every edit. Soarer's tools for making changes are command line based (and open source, unlike the firmware itself, which will be eventually). I edit text files, then hit a couple of commands in Terminal, and the deed is done. But it could use a more visual, interactive and forgiving interface.

User avatar
scottc

08 Mar 2014, 00:46

You could also consider parsing the JSON output from keyboard-layout-editor.com as input. That would be nice for quickly prototyping layouts. Maybe you'll see a pull request from me soon... Just thinking aloud here, don't mind me... :D

CJNE

08 Mar 2014, 00:53

scottc wrote:You could also consider parsing the JSON output from keyboard-layout-editor.com as input. That would be nice for quickly prototyping layouts. Maybe you'll see a pull request from me soon... Just thinking aloud here, don't mind me... :D
Cool, will take a look at that site :)
Muirium wrote:Soarer's uses NVRAM on the Teensy to store configuration, so you can edit on the fly.
Aha, that would require a different approach but maybe it could be made to look and work the same... interesting!

User avatar
scottc

08 Mar 2014, 01:34

I found a bug! :shock: I'm working away at trying to add my own layout but I'm getting sleepy so I think I'll continue tomorrow.

CJNE

08 Mar 2014, 01:43

scottc wrote:I found a bug! :shock:
Oh my, a bug? Really? :P
To be honest i'm glad it worked at all outside my own computer :)

User avatar
scottc

08 Mar 2014, 01:54

Yep, nothing serious though. When drawing the matrix you have a hard-coded number of keys (I'm guessing the amount the Ergodox has :P) which means that it throws confusing errors when trying to load other keymaps. :D I've sent a pull request.

CJNE

08 Mar 2014, 02:27

Well spotted, it's merged!

User avatar
uberben

12 Mar 2014, 21:37

This looks awesome, CJNE! I'm about to pick up my Kinesis controller replacement project again (using TMK) and was wanting to do something similar to this. If it hasn't been done already, I'll see what I can do to make it fit the Kinesis.

CJNE

12 Mar 2014, 23:47

uberben: Thanks! Let me know if you need any assistance with adding a layout for the Kinesis (has not been done).

Making some progress on action editing, it mostly works now but there are still some UX things to do, and macros are missing.
Here's the current state:
Vikeys 0.0.7
Vikeys 0.0.7
vikeys0.6.0.png (33.03 KiB) Viewed 1423 times

User avatar
scottc

15 Mar 2014, 01:27

How can you define keys that aren't a multiple of 0.5U? Like Caps Lock or ANSI enter, for example?

CJNE

16 Mar 2014, 00:40

You can, in theory, increase the resolution by making the layout array bigger. But there is also a limit in screen resolution so unless you have a very big terminal window you probably won't be able to see the difference anyway...
For the ergodox layout each 1U is represented by 2x2 array entries, so a 1.5U key would be 3x2, 2U is 4x2 etc.
To get 0.25U resolution you would have to double the sizes, and double again to get 0.125U resolution.
It will be a lot of work to type it in but it wont affect performance, it's parsed only once..

Did that make sense?

User avatar
scottc

16 Mar 2014, 01:34

Ohh, I see. I misunderstood what was happening there, then. And the layout is only used for figuring out the physical wiring of rows/columns?

CJNE

16 Mar 2014, 01:41

Yep!
And it can currently only display rectangular shapes, so an ISO enter key will not be possible...

User avatar
scottc

16 Mar 2014, 01:45

Cool! Thanks for the tip.

I'm still encountering a couple of bugs (on Linux, if that makes a difference):
- If the terminal window is maximised onscreen, I can't click some keys on the right hand side
- After putting a layout in keyboards.js, assigning all of the keys some values and hitting "save", it crashes. I can't remember the error and don't have my laptop around right now to check, but I believe it was "cannot read length of undefined". Might be another ergodox-specific magic number, perhaps?

Any ideas? :)

CJNE

16 Mar 2014, 02:04

The first problem will need some testing, haven't tried on Linux yet but i plan to do so soon :)
I have pushed a fix for the other problem to github just now, i think it should work!

User avatar
scottc

16 Mar 2014, 02:17

Great! I'll test the second part but it takes quite some time because I need to assign all 70 keys. :D

CJNE

16 Mar 2014, 02:24

It should save event if you haven't assigned all keys, in theory :) I'm off to bed now but if you still have problems i can check tomorrow.

User avatar
scottc

16 Mar 2014, 02:25

Saving works now! But loading doesn't: "cannot read length of undefined" :P

Edit: Now it does! You've got a pull request. 8-)

User avatar
HaaTa
Master Kiibohd Hunter

16 Mar 2014, 04:11

Interesting...
I may have to look at this later. If it looks usable I don't mind writing patches for Linux support.

User avatar
scottc

16 Mar 2014, 04:20

It seems to work perfectly on Linux apart from that one strange bug, for what it's worth.

Post Reply

Return to “Workshop”