@@ -30,13 +30,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
30
30
31
31
let invalidImg : NSImage ! = NSImage ( named: " statusitemerror " )
32
32
invalidImg. isTemplate = true
33
-
34
- let bar = NSStatusBar . system
33
+
35
34
// Workaround for some bug: -1 instead of NSVariableStatusItemLength
36
- statusItem = bar . statusItem ( withLength: CGFloat ( - 1 ) )
35
+ statusItem = NSStatusBar . system . statusItem ( withLength: CGFloat ( - 1 ) )
37
36
statusItem. menu = statusItemMenu
38
- statusItem. highlightMode = true
39
- statusItem. image = invalidImg
37
+ ( statusItem. button? . cell! as! NSButtonCell ) . highlightsBy = NSCell . StyleMask. changeBackgroundCellMask
38
+ statusItem. button? . image = invalidImg
39
+
40
40
toggleDockIcon ( showIcon: false )
41
41
42
42
func configureAppOptions(
@@ -57,9 +57,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
57
57
58
58
func updateStatus( valid: Bool ) {
59
59
if valid {
60
- statusItem. image = img
60
+ statusItem. button ? . image = img
61
61
} else {
62
- statusItem. image = invalidImg
62
+ statusItem. button ? . image = invalidImg
63
63
}
64
64
}
65
65
@@ -235,31 +235,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
235
235
} )
236
236
}
237
237
238
- func getActiveApp( browsers: [ BrowserOpts ] ) -> BrowserOpts ? {
239
- if browsers. count == 0 {
240
- return nil
241
- }
242
-
243
- if browsers. count == 1 {
244
- return browsers. first
245
- }
246
-
247
- for browser in browsers {
248
- if let bundleId = browser. bundleId {
249
- let apps = NSRunningApplication . runningApplications ( withBundleIdentifier: bundleId)
250
- if !apps. isEmpty {
251
- let app : NSRunningApplication = apps [ 0 ]
252
- let bundleIdentifier = app. bundleIdentifier
253
- if bundleIdentifier != nil {
254
- return browser
255
- }
256
- }
257
- }
258
- }
259
-
260
- // If we are here, no apps are running, so we return the first bundleIds in the array instead.
261
- return browsers. first
262
- }
263
238
264
239
@objc func callUrlHandlers( _ sourceBundleIdentifier: String ? , url: URL , sourceProcessPath: String ? ) {
265
240
if let appDescriptor = configLoader. determineOpeningApp ( url: url, sourceBundleIdentifier: sourceBundleIdentifier, sourceProcessPath: sourceProcessPath) {
@@ -294,12 +269,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
294
269
showTestConfigWindow ( nil )
295
270
}
296
271
297
- func openUrlWithBrowser( _ url: URL , browserOpts: BrowserOpts ) {
298
- print ( " Opening \( browserOpts) at: " + url. absoluteString)
299
- let command = getBrowserCommand ( browserOpts, url: url)
300
- shell ( command)
301
- }
302
-
303
272
func application( _: NSApplication , openFiles filenames: [ String ] ) {
304
273
toggleDockIcon ( showIcon: false )
305
274
for filename in filenames {
0 commit comments