From 5b6b6dfa56314d65fc6c58ae0690f81a1735ca01 Mon Sep 17 00:00:00 2001 From: Toxblh Date: Wed, 15 May 2019 16:39:32 +0100 Subject: [PATCH 1/3] Revert "fixed tests" This reverts commit 7c9dd26eb074577959e0f95e0be409d9b9ebf5fb. --- MTMR/Info.plist | 2 +- MTMRTests/ParseConfigTests.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MTMR/Info.plist b/MTMR/Info.plist index df5f206..3f8a189 100644 --- a/MTMR/Info.plist +++ b/MTMR/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 0.20.3 CFBundleVersion - 201 + 197 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/MTMRTests/ParseConfigTests.swift b/MTMRTests/ParseConfigTests.swift index ebea8a5..a3321cc 100644 --- a/MTMRTests/ParseConfigTests.swift +++ b/MTMRTests/ParseConfigTests.swift @@ -40,7 +40,7 @@ class ParseConfig: XCTestCase { XCTFail() return } - guard case .keyPressSession(keycode: 53)? = result?.first?.action else { + guard case .keyPress(keycode: 53)? = result?.first?.action else { XCTFail() return } @@ -55,7 +55,7 @@ class ParseConfig: XCTestCase { XCTFail() return } - guard case .keyPressSession(keycode: 53)? = result?.first?.action else { + guard case .keyPress(keycode: 53)? = result?.first?.action else { XCTFail() return } From 5fbb2bafc62c6381caee3d574fdf43611225a64a Mon Sep 17 00:00:00 2001 From: Toxblh Date: Wed, 15 May 2019 16:39:52 +0100 Subject: [PATCH 2/3] Revert "Fix #164" This reverts commit 40fa61fcb5e82a58481c5ca9e8607d74ecbe0e1b. --- MTMR/Info.plist | 2 +- MTMR/ItemsParsing.swift | 5 ++--- MTMR/KeyPress.swift | 10 ---------- MTMR/TouchBarController.swift | 2 -- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/MTMR/Info.plist b/MTMR/Info.plist index 3f8a189..06505cc 100644 --- a/MTMR/Info.plist +++ b/MTMR/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.20.3 + 0.20.2 CFBundleVersion 197 LSApplicationCategoryType diff --git a/MTMR/ItemsParsing.swift b/MTMR/ItemsParsing.swift index 01095de..8fa1413 100644 --- a/MTMR/ItemsParsing.swift +++ b/MTMR/ItemsParsing.swift @@ -51,7 +51,7 @@ class SupportedTypesHolder { private var supportedTypes: [String: ParametersDecoder] = [ "escape": { _ in ( item: .staticButton(title: "esc"), - action: .keyPressSession(keycode: 53), + action: .keyPress(keycode: 53), longAction: .none, parameters: [.align: .align(.left)] ) }, @@ -447,7 +447,7 @@ enum ItemType: Decodable { let workTime = try container.decodeIfPresent(Double.self, forKey: .workTime) ?? 1500.0 let restTime = try container.decodeIfPresent(Double.self, forKey: .restTime) ?? 600.0 self = .pomodoro(workTime: workTime, restTime: restTime) - + case .network: let flip = try container.decodeIfPresent(Bool.self, forKey: .flip) ?? false self = .network(flip: flip) @@ -459,7 +459,6 @@ enum ActionType: Decodable { case none case hidKey(keycode: Int32) case keyPress(keycode: Int) - case keyPressSession(keycode: Int) case appleScript(source: SourceProtocol) case shellScript(executable: String, parameters: [String]) case custom(closure: () -> Void) diff --git a/MTMR/KeyPress.swift b/MTMR/KeyPress.swift index c88b49f..a4afe2b 100644 --- a/MTMR/KeyPress.swift +++ b/MTMR/KeyPress.swift @@ -23,16 +23,6 @@ extension KeyPress { let keyDown = CGEvent(keyboardEventSource: src, virtualKey: keyCode, keyDown: true) let keyUp = CGEvent(keyboardEventSource: src, virtualKey: keyCode, keyDown: false) - let loc: CGEventTapLocation = .cghidEventTap - keyDown?.post(tap: loc) - keyUp?.post(tap: loc) - } - - func sendSession() { - let src = CGEventSource(stateID: .hidSystemState) - let keyDown = CGEvent(keyboardEventSource: src, virtualKey: keyCode, keyDown: true) - let keyUp = CGEvent(keyboardEventSource: src, virtualKey: keyCode, keyDown: false) - let loc: CGEventTapLocation = .cgAnnotatedSessionEventTap keyDown?.post(tap: loc) keyUp?.post(tap: loc) diff --git a/MTMR/TouchBarController.swift b/MTMR/TouchBarController.swift index 43776a9..a23ebe8 100644 --- a/MTMR/TouchBarController.swift +++ b/MTMR/TouchBarController.swift @@ -319,8 +319,6 @@ class TouchBarController: NSObject, NSTouchBarDelegate { return { HIDPostAuxKey(keycode) } case let .keyPress(keycode: keycode): return { GenericKeyPress(keyCode: CGKeyCode(keycode)).send() } - case let .keyPressSession(keycode: keycode): - return { GenericKeyPress(keyCode: CGKeyCode(keycode)).sendSession() } case let .appleScript(source: source): guard let appleScript = source.appleScript else { print("cannot create apple script for item \(item)") From 8a73fe01e42c6ce90494a2c749a6312e2069d8ae Mon Sep 17 00:00:00 2001 From: Toxblh Date: Wed, 15 May 2019 16:40:09 +0100 Subject: [PATCH 3/3] Revert "#154 .cghidEventTap -> .cgAnnotatedSessionEventTap" This reverts commit 5a8117ac7f0e5ab3898cf5a60699adcaa74733ea. --- MTMR/Info.plist | 4 ++-- MTMR/KeyPress.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MTMR/Info.plist b/MTMR/Info.plist index 06505cc..1180dfc 100644 --- a/MTMR/Info.plist +++ b/MTMR/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.20.2 + 0.20.1 CFBundleVersion - 197 + 185 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/MTMR/KeyPress.swift b/MTMR/KeyPress.swift index a4afe2b..1f68768 100644 --- a/MTMR/KeyPress.swift +++ b/MTMR/KeyPress.swift @@ -23,7 +23,7 @@ extension KeyPress { let keyDown = CGEvent(keyboardEventSource: src, virtualKey: keyCode, keyDown: true) let keyUp = CGEvent(keyboardEventSource: src, virtualKey: keyCode, keyDown: false) - let loc: CGEventTapLocation = .cgAnnotatedSessionEventTap + let loc: CGEventTapLocation = .cghidEventTap keyDown?.post(tap: loc) keyUp?.post(tap: loc) }