autostart

This commit is contained in:
j 2016-04-14 12:57:58 +02:00
parent 016c55d6f9
commit e8c8356dc9
2 changed files with 6 additions and 3 deletions

View file

@ -15,9 +15,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var statusMenu: NSMenu! @IBOutlet weak var statusMenu: NSMenu!
let autostart = Process.arguments.count >= 2 ? Process.arguments[1] == "--autostart" : false
let statusItem = NSStatusBar.systemStatusBar().statusItemWithLength(-1) let statusItem = NSStatusBar.systemStatusBar().statusItemWithLength(-1)
let basePath = NSString(string:"~/Library/Application Support/Open Media Library").stringByExpandingTildeInPath let basePath = NSString(string:"~/Library/Application Support/Open Media Library").stringByExpandingTildeInPath
func applicationDidFinishLaunching(aNotification: NSNotification) { func applicationDidFinishLaunching(aNotification: NSNotification) {
let icon = NSImage(named: "statusIcon") let icon = NSImage(named: "statusIcon")
//invert icon in dark status bar mode //invert icon in dark status bar mode
@ -31,8 +33,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
server.launchPath = basePath.stringByAppendingString("/ctl") server.launchPath = basePath.stringByAppendingString("/ctl")
server.arguments = ["start"] server.arguments = ["start"]
server.launch() server.launch()
load() if (!autostart) {
load()
}
} else { } else {
let resourcePath = NSBundle.mainBundle().resourcePath let resourcePath = NSBundle.mainBundle().resourcePath
let install_py = resourcePath?.stringByAppendingString("/install.py") let install_py = resourcePath?.stringByAppendingString("/install.py")

View file

@ -19,7 +19,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.7</string> <string>0.8</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleSupportedPlatforms</key> <key>CFBundleSupportedPlatforms</key>