Skip to content

Commit

Permalink
fix: touch bar's escape key works on mbp 15 2019 (closes lwouis#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
phungtuanhoang1996 committed Jan 20, 2020
1 parent 5b8a911 commit 9fd0c16
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions alt-tab-macos/logic/Keyboard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ func keyboardHandler(proxy: CGEventTapProxy, type: CGEventType, event_: CGEvent,
let isRightArrow = event.keyCode == kVK_RightArrow
let isLeftArrow = event.keyCode == kVK_LeftArrow
let isEscape = event.keyCode == kVK_Escape
if isMetaDown && type == .keyDown {

if type == .keyDown && isEscape {
return dispatchWork(application, false, { application.hideUi() })
} else if isMetaDown && type == .keyDown {
if isTab && event.modifierFlags.contains(.shift) {
return dispatchWork(application, true, { application.showUiOrCycleSelection(-1) })
} else if isTab {
Expand All @@ -57,8 +60,6 @@ func keyboardHandler(proxy: CGEventTapProxy, type: CGEventType, event_: CGEvent,
return dispatchWork(application, true, { application.cycleSelection(1) })
} else if isLeftArrow && application.appIsBeingUsed {
return dispatchWork(application, true, { application.cycleSelection(-1) })
} else if type == .keyDown && isEscape {
return dispatchWork(application, false, { application.hideUi() })
}
} else if isMetaChanged && !isMetaDown {
return dispatchWork(application, false, { application.focusTarget() })
Expand Down

0 comments on commit 9fd0c16

Please sign in to comment.