Compare commits

..

2 Commits

Author SHA1 Message Date
felixzsh de87aff505 Expand media and laptop key labels 2026-09-06 20:41:09 -05:00
alan 11f7083a9b Add F13-F24, media keys, and a fallback label for unknown keys
Extended function keys and media/laptop keys were missing from the keycode
table, so pressing them showed nothing. Unknown keycodes now render as
"Key <evdev code>" instead of being dropped silently.
2026-09-07 00:53:17 +01:00
+18 -1
View File
@@ -90,6 +90,22 @@ local KEYS = {
[87] = "KP1", [88] = "KP2", [89] = "KP3", [90] = "KP0", [91] = "KP.",
[121] = "Mute", [122] = "Vol-", [123] = "Vol+",
[94] = "\\", [51] = "\\",
-- Extended function keys (F13-F24), common on macros/layers and
-- programmable keyboards.
[191] = "F13", [192] = "F14", [193] = "F15", [194] = "F16", [195] = "F17", [196] = "F18",
[197] = "F19", [198] = "F20", [199] = "F21", [200] = "F22", [201] = "F23", [202] = "F24",
-- Media and laptop keys.
[171] = "Next", [172] = "Play", [173] = "Prev", [174] = "Stop",
[232] = "Bright-", [233] = "Bright+", [256] = "Mic Mute",
[124] = "Power", [150] = "Sleep", [148] = "Calc", [163] = "Mail",
[166] = "Back", [167] = "Forward", [225] = "Search",
[158] = "WWW", [164] = "Bookmarks", [165] = "Computer", [162] = "Cycle Windows",
[152] = "File", [179] = "Config", [180] = "Home", [181] = "Refresh",
[169] = "Eject", [170] = "Eject Close", [236] = "Kbd Light", [237] = "Kbd Light-",
[238] = "Kbd Light+", [244] = "Battery", [245] = "Bluetooth", [246] = "WLAN",
[234] = "Media", [439] = "Display", [452] = "Notification",
[538] = "Touchpad", [539] = "Touchpad On", [540] = "Touchpad Off",
[599] = "Do Not Disturb",
}
-- Printable characters (US layout), unshifted.
@@ -149,7 +165,8 @@ local function key_label(kc, binding)
local label = KEYS[kc]
if label then return label end
local ch = CHARS[kc]
if not ch then return nil end
-- Unknown key: show its evdev code instead of dropping it silently.
if not ch then return "Key " .. (kc - 8) end
if binding then return string.upper(ch) end
if shift_down() then
return SHIFTED[kc] or string.upper(ch)