Rev 1 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 5 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | 24 | ||
25 | var mouseHandler: MouseHandler! |
25 | var mouseHandler: MouseHandler! |
26 | 26 | ||
27 | let statusBarItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) |
27 | let statusBarItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) |
28 | let screenMenu = NSMenu() |
28 | let screenMenu = NSMenu() |
29 | let window = FirstBootWindowController(windowNibName: NSNib.Name ("FirstBootWindowController")) |
29 | //let window = FirstBootWindowController(windowNibName: NSNib.Name ("FirstBootWindowController")) |
30 | 30 | ||
31 | func applicationDidFinishLaunching(_ aNotification: Notification) { |
31 | func applicationDidFinishLaunching(_ aNotification: Notification) { |
32 | 32 | /* |
|
33 | if !UserDefaults.standard.bool(forKey: "firstBoot") { |
33 | if !UserDefaults.standard.bool(forKey: "firstBoot") { |
34 | window.completion = {[unowned self] in |
34 | window.completion = {[unowned self] in |
35 | self.setupApp() |
35 | self.setupApp() |
36 | } |
36 | } |
37 | window.showWindow(self) |
37 | window.showWindow(self) |
38 | } else { |
38 | } else {*/ |
39 | setupApp() |
39 | setupApp() |
- | 40 | // } |
|
- | 41 | ||
- | 42 | // attempt a keystroke ; if it fails, notify the user that he needs to allow the app |
|
- | 43 | let script = NSAppleScript(source: "tell app \"System Events\"\n" + |
|
- | 44 | " key down shift\n" + |
|
- | 45 | " key up shift\n" + |
|
- | 46 | "end tell")! // harmless keystroke |
|
- | 47 | var error: NSDictionary? = nil |
|
- | 48 | let resultMaybe = script.executeAndReturnError(&error) as NSAppleEventDescriptor? |
|
- | 49 | if (resultMaybe == nil) |
|
- | 50 | { |
|
- | 51 | let myStringDict = error as? [String:AnyObject] |
|
- | 52 | if (myStringDict?["NSAppleScriptErrorNumber"] as! Int16 == 1002) { |
|
- | 53 | let alert = NSAlert() |
|
- | 54 | alert.addButton(withTitle: "OK".localized) |
|
- | 55 | alert.messageText = "system_message".localized + "\n" + (myStringDict?["NSAppleScriptErrorBriefMessage"] as! String) |
|
- | 56 | alert.informativeText = "allow_perms".localized |
|
- | 57 | alert.alertStyle = .warning |
|
- | 58 | alert.runModal() |
|
- | 59 | } |
|
- | 60 | print (error as Any) |
|
- | 61 | exit (1) |
|
40 | } |
62 | } |
41 | } |
63 | } |
42 | 64 | ||
43 | func setupApp() { |
65 | func setupApp() { |
44 | //Add menuItem to menu |
66 | //Add menuItem to menu |