Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 45 additions & 21 deletions bootcommand/boot_command.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions bootcommand/boot_command.pigeon
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ SpecialKey = "bs"i / "del"i / "enter"i / "esc"i / "f10"i / "f11"i / "f12"i
/ "return"i / "tab"i / "up"i / "down"i / "spacebar"i / "insert"i / "home"i
/ "end"i / "pageUp"i / "pageDown"i / "leftAlt"i / "leftCtrl"i / "leftShift"i
/ "rightAlt"i / "rightCtrl"i / "rightShift"i / "leftSuper"i / "rightSuper"i
/ "leftCommand"i / "rightCommand"i / "leftOption"i / "rightOption"i
// left/right must go last, to not take priority over {left/right}Foo
/ "left"i / "right"i / "menu"i
Comment on lines +71 to 73
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grammar now accepts <leftCommand>, <rightCommand>, <leftOption>, and <rightOption>, but the PC-XT driver (pc_xt_driver.go) does not map these specials. This means templates using these keys will parse successfully but fail at runtime with “special … not found” when the PC-XT driver is used. Consider adding aliases in the PC-XT driver (e.g., command -> left/right super (GUI), option -> left/right alt) or restrict/qualify these tokens to drivers that support them.

Copilot uses AI. Check for mistakes.

NonZeroDigit = [1-9]
Expand Down
6 changes: 5 additions & 1 deletion bootcommand/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ const PackerKeyDefault = 100 * time.Millisecond
//
// - `<leftShift> <rightShift>` - Simulates pressing the shift key.
//
// - `<leftSuper> <rightSuper>` - Simulates pressing the ⌘ or Windows key.
// - `<leftSuper> <rightSuper>` - Simulates pressing the super key.
//
// - `<leftCommand> <rightCommand>` - Simulates pressing the ⌘ key.
//
// - `<leftOption> <rightOption>` - Simulates pressing the ⌥ key.
Comment on lines +69 to +71
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doc block now lists <leftCommand>/<rightCommand> and <leftOption>/<rightOption> as generally available special keys, but the PC-XT driver does not currently implement these mappings. Either add the aliases to the PC-XT driver or clarify here that these keys are only supported by specific drivers (e.g., VNC/USB) to avoid runtime surprises.

Suggested change
// - `<leftCommand> <rightCommand>` - Simulates pressing the ⌘ key.
//
// - `<leftOption> <rightOption>` - Simulates pressing the ⌥ key.
// - `<leftCommand> <rightCommand>` - Simulates pressing the ⌘ key. Supported
// only by certain keyboard drivers (such as VNC/USB), and not by all
// builders (for example, the legacy PC-XT driver).
//
// - `<leftOption> <rightOption>` - Simulates pressing the ⌥ key. Supported
// only by certain keyboard drivers (such as VNC/USB), and not by all
// builders (for example, the legacy PC-XT driver).

Copilot uses AI. Check for mistakes.
//
// - `<wait> <wait5> <wait10>` - Adds a 1, 5 or 10 second pause before
// sending any additional keys. This is useful if you have to generally
Expand Down
6 changes: 6 additions & 0 deletions bootcommand/usb_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ func NewUSBDriver(send SendUsbScanCodes, interval time.Duration) *usbDriver {
"leftsuper": key.CodeLeftGUI,
"rightsuper": key.CodeRightGUI,
"spacebar": key.CodeSpacebar,

// https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf
"leftcommand": key.CodeLeftGUI,
"rightcommand": key.CodeRightGUI,
"leftoption": key.CodeLeftAlt,
"rightoption": key.CodeRightAlt,
}
Comment on lines +77 to 82
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New special-key mappings were added here, but the USB driver tests currently don’t cover <leftCommand>, <rightCommand>, <leftOption>, or <rightOption>. Consider adding cases to usb_driver_test.go to verify these tokens map to the intended key.Code values (and that mixed-case input still works).

Copilot uses AI. Check for mistakes.

scancodeIndex := make(map[string]key.Code)
Expand Down
6 changes: 6 additions & 0 deletions bootcommand/vnc_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ func NewVNCDriver(c VNCKeyEvent, interval time.Duration) *vncDriver {
sMap["tab"] = 0xFF09
sMap["up"] = 0xFF52

// Verified against the built-in VNC server on macOS
sMap["leftcommand"] = 0xFFE9
sMap["rightcommand"] = 0xFFEA
sMap["leftoption"] = 0xFFE7
sMap["rightoption"] = 0xFFE8
Comment on lines +81 to +85
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New special-key mappings were added here, but there’s no corresponding test coverage to ensure <leftCommand>, <rightCommand>, <leftOption>, and <rightOption> generate the expected keysyms (and remain case-insensitive). Consider extending vnc_driver_test.go to assert the emitted key events for these new tokens.

Copilot uses AI. Check for mistakes.

return &vncDriver{
c: c,
interval: keyInterval,
Expand Down