CI / build-and-test (push) Canceled after 0s
Semi-transparent always-on-top Windows overlay that shows the keymap of a Vial/QMK split keyboard (Silakka54). - draws all layers from a Vial .vil layout, transparent keys fall through - detects the active layer from the keyboard via a Raw HID command (firmware/) - shows characters of the active Windows input language - can split the two halves into separate, independently movable windows - highlights pressed keys; tray menu for opacity, size and options - Inno Setup installer and portable build; GitHub-style CI workflow
32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
//
|
|
// KeyOverlay: lets the host ask which layer is active.
|
|
//
|
|
// Request (host -> keyboard): [0xE0, 0x01, ...]
|
|
// Response (keyboard -> host): [0xE0, 0x01, highest_layer, layer_state (u32 LE), default_layer_state (u32 LE), ...]
|
|
//
|
|
// 0xE0 is outside the ids used by VIA (0x01..0x1F), Vial (0xFE) and "unhandled" (0xFF).
|
|
// Only reads state; it changes nothing on the keyboard and works while Vial is locked.
|
|
#include QMK_KEYBOARD_H
|
|
#include "raw_hid.h"
|
|
#include <string.h>
|
|
|
|
#define KEYOVERLAY_CMD 0xE0
|
|
#define KEYOVERLAY_PROTOCOL 0x01
|
|
#define KEYOVERLAY_ID_UNHANDLED 0xFF
|
|
#define KEYOVERLAY_MIN_LENGTH 11
|
|
|
|
void raw_hid_receive_kb(uint8_t *data, uint8_t length) {
|
|
if (data[0] != KEYOVERLAY_CMD || length < KEYOVERLAY_MIN_LENGTH) {
|
|
data[0] = KEYOVERLAY_ID_UNHANDLED;
|
|
return;
|
|
}
|
|
const uint32_t active = (uint32_t)layer_state;
|
|
const uint32_t default_ = (uint32_t)default_layer_state;
|
|
|
|
data[1] = KEYOVERLAY_PROTOCOL;
|
|
data[2] = get_highest_layer(layer_state | default_layer_state);
|
|
memcpy(&data[3], &active, sizeof(active));
|
|
memcpy(&data[7], &default_, sizeof(default_));
|
|
}
|