Files
ElyOffice/tests/scripts/chord.swift
T
ZacharyZhang-NY 98d7e75fca
release / macos (arm64, macos-15) (push) Canceled after 0s
release / macos (x86_64, macos-15-intel) (push) Canceled after 0s
Bench: edits timed at the drawn tile; per-cycle document counts; posted chords
2026-10-08 22:22:29 -04:00

15 lines
466 B
Swift

// Posts Command plus a key to one process, flag included.
import CoreGraphics
import Foundation
// chord <pid> <virtual key code>
let pid = pid_t(CommandLine.arguments[1])!
let code = CGKeyCode(CommandLine.arguments[2])!
let source = CGEventSource(stateID: .privateState)
for down in [true, false] {
let event = CGEvent(keyboardEventSource: source, virtualKey: code, keyDown: down)!
event.flags = .maskCommand
event.postToPid(pid)
usleep(30_000)
}