mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-10 17:08:39 +00:00
merge master
This commit is contained in:
commit
7cc72de66f
@ -17,9 +17,13 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.20.3</string>
|
<string>0.20.1</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
|
<<<<<<< HEAD
|
||||||
<string>250</string>
|
<string>250</string>
|
||||||
|
=======
|
||||||
|
<string>185</string>
|
||||||
|
>>>>>>> origin/master
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
<string>public.app-category.utilities</string>
|
<string>public.app-category.utilities</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class SupportedTypesHolder {
|
|||||||
private var supportedTypes: [String: ParametersDecoder] = [
|
private var supportedTypes: [String: ParametersDecoder] = [
|
||||||
"escape": { _ in (
|
"escape": { _ in (
|
||||||
item: .staticButton(title: "esc"),
|
item: .staticButton(title: "esc"),
|
||||||
action: .keyPressSession(keycode: 53),
|
action: .keyPress(keycode: 53),
|
||||||
longAction: .none,
|
longAction: .none,
|
||||||
parameters: [.align: .align(.left)]
|
parameters: [.align: .align(.left)]
|
||||||
) },
|
) },
|
||||||
@ -452,7 +452,7 @@ enum ItemType: Decodable {
|
|||||||
let workTime = try container.decodeIfPresent(Double.self, forKey: .workTime) ?? 1500.0
|
let workTime = try container.decodeIfPresent(Double.self, forKey: .workTime) ?? 1500.0
|
||||||
let restTime = try container.decodeIfPresent(Double.self, forKey: .restTime) ?? 600.0
|
let restTime = try container.decodeIfPresent(Double.self, forKey: .restTime) ?? 600.0
|
||||||
self = .pomodoro(workTime: workTime, restTime: restTime)
|
self = .pomodoro(workTime: workTime, restTime: restTime)
|
||||||
|
|
||||||
case .network:
|
case .network:
|
||||||
let flip = try container.decodeIfPresent(Bool.self, forKey: .flip) ?? false
|
let flip = try container.decodeIfPresent(Bool.self, forKey: .flip) ?? false
|
||||||
self = .network(flip: flip)
|
self = .network(flip: flip)
|
||||||
@ -464,7 +464,6 @@ enum ActionType: Decodable {
|
|||||||
case none
|
case none
|
||||||
case hidKey(keycode: Int32)
|
case hidKey(keycode: Int32)
|
||||||
case keyPress(keycode: Int)
|
case keyPress(keycode: Int)
|
||||||
case keyPressSession(keycode: Int)
|
|
||||||
case appleScript(source: SourceProtocol)
|
case appleScript(source: SourceProtocol)
|
||||||
case shellScript(executable: String, parameters: [String])
|
case shellScript(executable: String, parameters: [String])
|
||||||
case custom(closure: () -> Void)
|
case custom(closure: () -> Void)
|
||||||
|
|||||||
@ -27,16 +27,6 @@ extension KeyPress {
|
|||||||
keyDown?.post(tap: loc)
|
keyDown?.post(tap: loc)
|
||||||
keyUp?.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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func HIDPostAuxKey(_ key: Int32) {
|
func HIDPostAuxKey(_ key: Int32) {
|
||||||
|
|||||||
@ -319,8 +319,6 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
|
|||||||
return { HIDPostAuxKey(keycode) }
|
return { HIDPostAuxKey(keycode) }
|
||||||
case let .keyPress(keycode: keycode):
|
case let .keyPress(keycode: keycode):
|
||||||
return { GenericKeyPress(keyCode: CGKeyCode(keycode)).send() }
|
return { GenericKeyPress(keyCode: CGKeyCode(keycode)).send() }
|
||||||
case let .keyPressSession(keycode: keycode):
|
|
||||||
return { GenericKeyPress(keyCode: CGKeyCode(keycode)).sendSession() }
|
|
||||||
case let .appleScript(source: source):
|
case let .appleScript(source: source):
|
||||||
guard let appleScript = source.appleScript else {
|
guard let appleScript = source.appleScript else {
|
||||||
print("cannot create apple script for item \(item)")
|
print("cannot create apple script for item \(item)")
|
||||||
|
|||||||
@ -40,7 +40,7 @@ class ParseConfig: XCTestCase {
|
|||||||
XCTFail()
|
XCTFail()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
guard case .keyPressSession(keycode: 53)? = result?.first?.action else {
|
guard case .keyPress(keycode: 53)? = result?.first?.action else {
|
||||||
XCTFail()
|
XCTFail()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ class ParseConfig: XCTestCase {
|
|||||||
XCTFail()
|
XCTFail()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
guard case .keyPressSession(keycode: 53)? = result?.first?.action else {
|
guard case .keyPress(keycode: 53)? = result?.first?.action else {
|
||||||
XCTFail()
|
XCTFail()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user