diff --git a/Lib/Sauce/InputSource.swift b/Lib/Sauce/InputSource.swift index d85ed0e..49b553b 100644 --- a/Lib/Sauce/InputSource.swift +++ b/Lib/Sauce/InputSource.swift @@ -11,7 +11,7 @@ import Foundation import Carbon -public final class InputSource { +open class InputSource { // MARK: - Properties public let id: String diff --git a/Lib/Sauce/ModifierTransformer.swift b/Lib/Sauce/ModifierTransformer.swift index 3dfdfb4..12cfc59 100644 --- a/Lib/Sauce/ModifierTransformer.swift +++ b/Lib/Sauce/ModifierTransformer.swift @@ -12,11 +12,11 @@ import Foundation import Carbon import AppKit -final class ModifierTransformer {} +open class ModifierTransformer {} // MARK: - Cocoa & Carbon extension ModifierTransformer { - func carbonFlags(from cocoaFlags: NSEvent.ModifierFlags) -> Int { + public func carbonFlags(from cocoaFlags: NSEvent.ModifierFlags) -> Int { var carbonFlags: Int = 0 if cocoaFlags.contains(.command) { carbonFlags |= cmdKey @@ -33,7 +33,7 @@ extension ModifierTransformer { return carbonFlags } - func convertCharactorSupportCarbonModifiers(from carbonModifiers: Int) -> Int { + public func convertCharactorSupportCarbonModifiers(from carbonModifiers: Int) -> Int { var convertedCarbonModifiers: Int = 0 if (carbonModifiers & optionKey) != 0 { convertedCarbonModifiers |= optionKey diff --git a/Lib/Sauce/Sauce.swift b/Lib/Sauce/Sauce.swift index ed24697..3eba989 100644 --- a/Lib/Sauce/Sauce.swift +++ b/Lib/Sauce/Sauce.swift @@ -11,13 +11,13 @@ import Foundation import AppKit -public extension NSNotification.Name { +extension NSNotification.Name { static let SauceSelectedKeyboardInputSourceChanged = Notification.Name("SauceSelectedKeyboardInputSourceChanged") static let SauceEnabledKeyboardInputSourcesChanged = Notification.Name("SauceEnabledKeyboardInputSourcesChanged") static let SauceSelectedKeyboardKeyCodesChanged = Notification.Name("SauceSelectedKeyboardKeyCodesChanged") } -public final class Sauce { +open class Sauce { // MARK: - Properties public static let shared = Sauce() @@ -34,81 +34,81 @@ public final class Sauce { } // MARK: - Input Sources -public extension Sauce { - func currentInputSources() -> [InputSource] { +extension Sauce { + public func currentInputSources() -> [InputSource] { return layout.inputSources } } // MARK: - KeyCodes -public extension Sauce { - func keyCode(for key: Key) -> CGKeyCode { +extension Sauce { + public func keyCode(for key: Key) -> CGKeyCode { return currentKeyCode(for: key) ?? key.QWERTYKeyCode } - func currentKeyCode(for key: Key) -> CGKeyCode? { + public func currentKeyCode(for key: Key) -> CGKeyCode? { return layout.currentKeyCode(for: key) } - func currentKeyCodes() -> [Key: CGKeyCode]? { + public func currentKeyCodes() -> [Key: CGKeyCode]? { return layout.currentKeyCodes() } - func keyCode(with source: InputSource, key: Key) -> CGKeyCode? { + public func keyCode(with source: InputSource, key: Key) -> CGKeyCode? { return layout.keyCode(with: source, key: key) } - func keyCodes(with source: InputSource) -> [Key: CGKeyCode]? { + public func keyCodes(with source: InputSource) -> [Key: CGKeyCode]? { return layout.keyCodes(with: source) } } // MARK: - Key -public extension Sauce { - func key(for keyCode: Int) -> Key? { +extension Sauce { + public func key(for keyCode: Int) -> Key? { return currentKey(for: keyCode) ?? Key(QWERTYKeyCode: keyCode) } - func currentKey(for keyCode: Int) -> Key? { + public func currentKey(for keyCode: Int) -> Key? { return layout.currentKey(for: keyCode) } - func key(with source: InputSource, keyCode: Int) -> Key? { + public func key(with source: InputSource, keyCode: Int) -> Key? { return layout.key(with: source, keyCode: keyCode) } } // MARK: - Characters -public extension Sauce { - func character(for keyCode: Int, carbonModifiers: Int) -> String? { +extension Sauce { + public func character(for keyCode: Int, carbonModifiers: Int) -> String? { return currentCharacter(for: keyCode, carbonModifiers: carbonModifiers) ?? currentASCIICapableCharacter(for: keyCode, carbonModifiers: carbonModifiers) } - func character(for keyCode: Int, cocoaModifiers: NSEvent.ModifierFlags) -> String? { + public func character(for keyCode: Int, cocoaModifiers: NSEvent.ModifierFlags) -> String? { return character(for: keyCode, carbonModifiers: modifierTransformar.carbonFlags(from: cocoaModifiers)) } - func currentCharacter(for keyCode: Int, carbonModifiers: Int) -> String? { + public func currentCharacter(for keyCode: Int, carbonModifiers: Int) -> String? { return layout.currentCharacter(for: keyCode, carbonModifiers: carbonModifiers) } - func currentCharacter(for keyCode: Int, cocoaModifiers: NSEvent.ModifierFlags) -> String? { + public func currentCharacter(for keyCode: Int, cocoaModifiers: NSEvent.ModifierFlags) -> String? { return currentCharacter(for: keyCode, carbonModifiers: modifierTransformar.carbonFlags(from: cocoaModifiers)) } - func currentASCIICapableCharacter(for keyCode: Int, carbonModifiers: Int) -> String? { + public func currentASCIICapableCharacter(for keyCode: Int, carbonModifiers: Int) -> String? { return layout.currentASCIICapableCharacter(for: keyCode, carbonModifiers: carbonModifiers) } - func currentASCIICapableCharacter(for keyCode: Int, cocoaModifiers: NSEvent.ModifierFlags) -> String? { + public func currentASCIICapableCharacter(for keyCode: Int, cocoaModifiers: NSEvent.ModifierFlags) -> String? { return currentASCIICapableCharacter(for: keyCode, carbonModifiers: modifierTransformar.carbonFlags(from: cocoaModifiers)) } - func character(with source: InputSource, keyCode: Int, carbonModifiers: Int) -> String? { + public func character(with source: InputSource, keyCode: Int, carbonModifiers: Int) -> String? { return layout.character(with: source, keyCode: keyCode, carbonModifiers: carbonModifiers) } - func character(with source: InputSource, keyCode: Int, cocoaModifiers: NSEvent.ModifierFlags) -> String? { + public func character(with source: InputSource, keyCode: Int, cocoaModifiers: NSEvent.ModifierFlags) -> String? { return character(with: source, keyCode: keyCode, carbonModifiers: modifierTransformar.carbonFlags(from: cocoaModifiers)) } }