diff --git a/CHANGELOG.md b/CHANGELOG.md index 2df90a69c2f..7b91900c689 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1 Every Agent version includes the most recent firmware version. See the [firmware changelog](https://github.com/UltimateHackingKeyboard/firmware/blob/master/CHANGELOG.md). +## [Unreleased] + +- Show which keymap is currently active on the keyboard in the sidebar, and mark inactive keymaps in the header. `DEVICEPROTOCOL:MINOR` + ## [10.1.0] - 2026-06-23 Firmware: 17.2.0 [[release](https://github.com/UltimateHackingKeyboard/firmware/releases/tag/v17.2.0)] | Device Protocol: 4.17.0 | User Config: 14.0.0 | Hardware Config: 1.0.0 diff --git a/packages/uhk-common/src/models/device-connection-state.ts b/packages/uhk-common/src/models/device-connection-state.ts index 45a8983095a..a719d68c370 100644 --- a/packages/uhk-common/src/models/device-connection-state.ts +++ b/packages/uhk-common/src/models/device-connection-state.ts @@ -9,6 +9,10 @@ export interface DeviceConnectionState { // UHK80 connected via bluetooth bleDeviceConnected: boolean; isPairedWithDongle?: boolean; + /** + * Index of the keymap currently active on the keyboard (GetDeviceState byte 8). + */ + activeKeymapIndex?: number; connectedDevice?: UhkDeviceProduct; dongle: Dongle; leftHalfBootloaderActive: boolean; diff --git a/packages/uhk-common/src/util/index.ts b/packages/uhk-common/src/util/index.ts index 9917c00d7e2..3b0104be028 100644 --- a/packages/uhk-common/src/util/index.ts +++ b/packages/uhk-common/src/util/index.ts @@ -12,6 +12,7 @@ export * from './get-md5-hash-from-file-name.js'; export * from './get-slot-id-name.js'; export * from './helpers.js'; export * from './is-bit-set.js'; +export * from './is-device-protocol-support-active-keymap-index.js'; export * from './is-device-protocol-support-firmware-checksum.js'; export * from './is-device-protocol-support-git-info.js'; export * from './is-device-protocol-support-status-error.js'; diff --git a/packages/uhk-common/src/util/is-device-protocol-support-active-keymap-index.ts b/packages/uhk-common/src/util/is-device-protocol-support-active-keymap-index.ts new file mode 100644 index 00000000000..c93694eabd0 --- /dev/null +++ b/packages/uhk-common/src/util/is-device-protocol-support-active-keymap-index.ts @@ -0,0 +1,7 @@ +import { isVersionGteV1CanUndefined } from './version-helpers.js'; + +const DEVICE_PROTOCOL_VERSION_THAT_SUPPORT_ACTIVE_KEYMAP_INDEX = '4.10.0'; + +export function isDeviceProtocolSupportActiveKeymapIndex(deviceProtocolVersion: string): boolean { + return isVersionGteV1CanUndefined(deviceProtocolVersion, DEVICE_PROTOCOL_VERSION_THAT_SUPPORT_ACTIVE_KEYMAP_INDEX); +} diff --git a/packages/uhk-usb/src/models/device-state.ts b/packages/uhk-usb/src/models/device-state.ts index 116b1ab0bf0..952a8d5e387 100644 --- a/packages/uhk-usb/src/models/device-state.ts +++ b/packages/uhk-usb/src/models/device-state.ts @@ -4,6 +4,7 @@ export interface DeviceState { isZephyrLogAvailable: boolean; areHalvesMerged: boolean; isLeftHalfConnected: boolean; + activeKeymapIndex: number; activeLayerNumber: number; activeLayerName: string; activeLayerToggled: boolean; diff --git a/packages/uhk-usb/src/uhk-hid-device.ts b/packages/uhk-usb/src/uhk-hid-device.ts index b76863da208..5ee44b6e104 100644 --- a/packages/uhk-usb/src/uhk-hid-device.ts +++ b/packages/uhk-usb/src/uhk-hid-device.ts @@ -405,6 +405,7 @@ export class UhkHidDevice { if (result.connectedDevice && result.hasPermission && result.communicationInterfaceAvailable) { const deviceState = await this.getDeviceState(); + result.activeKeymapIndex = deviceState.activeKeymapIndex; result.halvesInfo = calculateHalvesState(deviceState); result.isMacroStatusDirty = deviceState.isMacroStatusDirty; result.isZephyrLogAvailable = deviceState.isZephyrLogAvailable; @@ -623,6 +624,7 @@ export class UhkHidDevice { isMacroStatusDirty: buffer[7] !== 0, areHalvesMerged: isBitSet(buffer[2], 0), isLeftHalfConnected: buffer[3] !== 0, + activeKeymapIndex: buffer[8], activeLayerNumber, activeLayerName: LAYER_NUMBER_TO_STRING[activeLayerNumber], activeLayerToggled: (buffer[6] & 0x80) === 1, diff --git a/packages/uhk-web/src/app/components/keymap/edit/keymap-edit.component.html b/packages/uhk-web/src/app/components/keymap/edit/keymap-edit.component.html index db0d86d2a8b..38bc0c348c2 100644 --- a/packages/uhk-web/src/app/components/keymap/edit/keymap-edit.component.html +++ b/packages/uhk-web/src/app/components/keymap/edit/keymap-edit.component.html @@ -1,6 +1,7 @@ ; selectedPaletteColorIndex$: Observable; showColorPalette$: Observable; + inactiveKeymapTooltip$: Observable; private routeSubscription: Subscription; private keymapSubscription: Subscription; @@ -134,6 +136,7 @@ export class KeymapEditComponent implements OnDestroy { this.showColorPalette$ = this.store.select(showColorPalette); this.paletteColors$ = this.store.select(backlightingColorPalette); this.selectedPaletteColorIndex$ = this.store.select(selectedBacklightingColorIndex); + this.inactiveKeymapTooltip$ = this.store.select(inactiveKeymapTooltip); } ngOnDestroy(): void { diff --git a/packages/uhk-web/src/app/components/keymap/header/keymap-header.component.html b/packages/uhk-web/src/app/components/keymap/header/keymap-header.component.html index 1af38d272ac..6410d8b0e0d 100644 --- a/packages/uhk-web/src/app/components/keymap/header/keymap-header.component.html +++ b/packages/uhk-web/src/app/components/keymap/header/keymap-header.component.html @@ -18,6 +18,12 @@ placement="bottom" (click)="setDefault()" > + (inactive) ; @ViewChild(AutoGrowInputComponent, { static: true }) keymapName: AutoGrowInputComponent; diff --git a/packages/uhk-web/src/app/components/side-menu/side-menu.component.html b/packages/uhk-web/src/app/components/side-menu/side-menu.component.html index f7774404455..a76589674f0 100644 --- a/packages/uhk-web/src/app/components/side-menu/side-menu.component.html +++ b/packages/uhk-web/src/app/components/side-menu/side-menu.component.html @@ -189,10 +189,16 @@ (click)="toggleMenuItem('keymap')">
    -