Skip to content

Commit

Permalink
fix: update key handling to use keyboardEventSource
Browse files Browse the repository at this point in the history
  • Loading branch information
socsieng committed Oct 6, 2023
1 parent bd2ecf1 commit c26bbfa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/SendKeysLib/KeyPresser.swift
Expand Up @@ -66,7 +66,8 @@ public class KeyPresser {
private func createKeyEvent(key: String, modifiers: [String], keyDown: Bool) throws -> CGEvent? {
let keycode = KeyCodes.getKeyCode(key)
let flags = try! KeyPresser.getModifierFlags(modifiers)
let keyEvent = CGEvent(keyboardEventSource: nil, virtualKey: keycode ?? 0, keyDown: keyDown)
let eventSource = CGEventSource(stateID: .hidSystemState)
let keyEvent = CGEvent(keyboardEventSource: eventSource, virtualKey: keycode ?? 0, keyDown: keyDown)

if keycode == nil {
if key.count == 1 {
Expand Down

0 comments on commit c26bbfa

Please sign in to comment.