Various Enhancements (#66)

* Update to Swift 5.0 and run `swiftformat`.

* Refactor `MediaKeyTap` start/restart.

* Remove useless comments.

* Reorder files.

* Add German translation.

* Switch to Carthage.

* Use `DDC.swift`.

* Add `NSScreen` extension.

* Simplify menu layout.

* Hide the display’s built-in OSD.

* Fix launch at login helper.

* Fix `quitClicked` connection.

* Refactor build phases.

* Use `os_log` instead of `print`.

* Use more specific check for `minReplyDelay`.

* Add whitelist.
This commit is contained in:
Markus Reiter 2019-05-07 15:01:26 +02:00 committed by Guillaume B
parent 830878ee1d
commit 6e91c71353
45 changed files with 1242 additions and 1334 deletions

View file

@ -1,32 +0,0 @@
//
// AppDelegate.swift
// MonitorControlHelper
//
// Created by Guillaume BRODER on 13/01/2018.
// Copyright © 2018 Mathew Kurian. All rights reserved.
//
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
func applicationDidFinishLaunching(_ aNotification: Notification) {
let bundlePath = Bundle.main.bundlePath as NSString
var pathComponents = bundlePath.pathComponents
for _ in 0...4 {
pathComponents.removeLast()
}
let path = NSString.path(withComponents: pathComponents)
NSWorkspace.shared.launchApplication(path)
NSApp.terminate(nil)
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
}

View file

@ -17,9 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.3.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>179</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSBackgroundOnly</key>
<true/>
<key>LSMinimumSystemVersion</key>

View file

@ -0,0 +1,26 @@
import Cocoa
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_: Notification) {
let mainBundleID = Bundle.main.bundleIdentifier!.replacingOccurrences(of: "Helper", with: "")
let bundlePath = Bundle.main.bundlePath as NSString
guard NSRunningApplication.runningApplications(withBundleIdentifier: mainBundleID).isEmpty else {
return NSApp.terminate(self)
}
var pathComponents = bundlePath.pathComponents
let path = NSString.path(withComponents: Array(pathComponents[0..<(pathComponents.count - 4)]))
NSWorkspace.shared.launchApplication(path)
NSApp.terminate(nil)
}
func applicationWillTerminate(_: Notification) {}
}
let app = NSApplication.shared
let delegate = AppDelegate()
app.delegate = delegate
app.run()