Via provides you the ability to re-configure your keyboard using the Via app,
instead of building and re-flashing your firmware. Via works by reading a JSON definition specific to your
keyboard. In order for the Via app to support your keyboard, these definitions need to be submitted
a repository, or sideloaded using Via’s Design tab.
Vial is an alternative, which aims to be decentralized.
To support your keyboard, the JSON definitions are built into the firmware itself, and the Vial
app will load the JSON data at runtime. This removes the need for JSON definitions to be uploaded
to a central repository.
rumcake provides you with the option of using Via, or Vial.
At this time, rumcake implements:
Via protocol version 12, which requires Via V3 definitions.
Vial protocol version 6, which is based on Via V2.
Setup
Required Cargo features
You must enable the following rumcake features:
via or vial (depending on what you want to use)
storage (optional, if you want to save changes you make in the Via/Vial app)
Required code
To set up Via and Vial support, you must add a new type to implement the ViaKeyboard trait on.
Then, you can add via(id = <type>) to your keyboard macro invocation.
Certain Via features need to be configured manually as well:
This can be done trivially with the setup_macro_buffer macro
If you are using some form of backlighting (simple-backlight, simple-backlight-matrix or rgb-backlight-matrix), you need to change BACKLIGHT_TYPE.
This controls how QK_BACKLIGHT keycodes get converted to keyberon actions. In other words, it controls the behaviour of BL_ prefixed keycodes in the Via app.
If you are using Vial, you must also implement VialKeyboard in addition to ViaKeyboard.
Instead of using via in your keyboard macro invocation, you should use vial.
The following code example shows how to implement the VialKeyboard trait, and uses a build script to
implement KEYBOARD_DEFINITION. Please follow the instructions in the Vial Definitions section.
To compile your Vial definition into the firmware, you must minify and LZMA compress your JSON definition file, and
pass the raw bytes to KEYBOARD_DEFINITION in the VialKeyboard trait implementation.
The basic template shows how you can achieve this using a build script (build.rs).
The build script does the following:
The build script will search for and open the JSON definition file for your keyboard. Place it at ./src/definition.json.
The build script will check for the vial feature flag, then minify and LZMA compress the JSON data.
The resulting bytes are written to a GENERATED_KEYBOARD_DEFINITION constant.
The GENERATED_KEYBOARD_DEFINITION constant can be used in your VialKeyboard trait implementation for KEYBOARD_DEFINITION.
Check the code example shown previously to see how to use this constant.
Recommended Via V3 Custom UI Definitions
If you are using regular Via (non-Vial), it is recommended to use the provided Custom UI
menus below to interact with rumcake’s extra features using Via. Feel free to choose
only the ones you need.
To add the menus you need, add the JSON directly to your "menus" field in your keyboard definition file.
Underglow Menu
Simple Backlight Menu
Simple Backlight Matrix Menu
Keycode support
rumcake does not support all the keycodes that Via/Vial shows in the app. Currently, the following keycodes are functional:
Basic keycodes (Basic tab in Via/Vial, or those available in HID keyboard reports)
Lighting keycodes, except for QK_BACKLIGHT_TOGGLE_BREATHING. RGB keycodes only work for underglow, not an RGB backlight matrix.
Momentary layers (MO(x))
Default layers (DF(x))
Toggle layers (TG(x))
One-shot layers (OSL(x))
Macro keycodes (M0, M1, M2 …)
Custom keycodes (customKeycodes in your JSON definition)
Certain media keycodes. Support for this must be enabled manually. Check the “Media Keys” doc
QK_OUTPUT_BLUETOOTH and QK_OUTPUT_USB
You can assume that any keycodes not listed above are not supported.
Attempts to use unsupported keycodes will not result in any changes to your layout. It may show in the Via app briefly, but reloading the app will revert the keycodes back to their previous state.
For the keycodes that are supported, there are still some limitations that apply. Usually these limitations
are due to memory constraints, while still allowing for the flexibility that keyberon’s actions provide.
It’s recommended to compile any non-basic actions directly into your firmware as opposed to assigning them
through Via.
One-shot Layer keycodes assigned through Via only works for layers 0 to 15.
One-shot actions that are already compiled into your keyberon layout can still work with greater layer numbers.
Sequence actions compiled into your keyberon layout will not show up in the Via app, it will show up as 0xFFFF.
For Vial, using delay events and tap/press/release events with non-basic keycodes (higher than 0x00FF) in macros will not work. Using them will abort the macro when the event is executed.
For backlighting keycodes to work, you need to modify the BACKLIGHT_TYPE constant in your ViaKeyboard implementation. This defines how the backlighting keycodes get converted.
RGB keycodes only work for underglow, not an RGB backlight matrix.
To-do List
Tap-toggle, one shot mod keycodes (and other keycodes in the “Layers” submenu)
QMK settings (Vial)
Dynamic keymap tap dance, combo, key overrides (Vial)
Vial macro support (delays and non-basic keycodes)