|
|
|
@ -14,14 +14,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|
|
|
|
// things that need to be retained to keep them from disappearing |
|
|
|
|
private var prefPanesSupport: Bundle! |
|
|
|
|
private var item: NSStatusItem! |
|
|
|
|
private var observation: NSKeyValueObservation? |
|
|
|
|
|
|
|
|
|
func applicationDidFinishLaunching(_ aNotification: Notification) { |
|
|
|
|
|
|
|
|
|
// this is where _setSwipeScrollDirection is defined |
|
|
|
|
prefPanesSupport = Bundle(path: "/System/Library/PrivateFrameworks/PreferencePanesSupport.framework") |
|
|
|
|
try! prefPanesSupport!.loadAndReturnError() |
|
|
|
|
|
|
|
|
|
item = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength) |
|
|
|
|
item.button!.target = self |
|
|
|
|
item.button!.action = #selector(menuItemClicked) |
|
|
|
@ -84,7 +78,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|
|
|
|
// makes system preferences update |
|
|
|
|
DistributedNotificationCenter.default().postNotificationName(.swipeScrollDirectionDidChangeNotification, object: nil, userInfo: nil, deliverImmediately: false) |
|
|
|
|
// make the actual input behavior update |
|
|
|
|
setSwipeScrollDirection(Int32(new.rawValue)) |
|
|
|
|
setSwipeScrollDirection(new == .natural) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -96,7 +90,7 @@ extension AppDelegate: NSMenuDelegate {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
enum Direction: Int, Equatable { |
|
|
|
|
enum Direction: Equatable { |
|
|
|
|
case normal, natural |
|
|
|
|
|
|
|
|
|
static var current: Direction { |
|
|
|
|