Skip to content

Commit 2aacb5d

Browse files
committed
Adapt to macOS Big Sur
1 parent 08752c5 commit 2aacb5d

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

NetSpeedMonitor.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@
390390
"$(inherited)",
391391
"@executable_path/../Frameworks",
392392
);
393-
MARKETING_VERSION = 1.4;
393+
MARKETING_VERSION = 1.5;
394394
PRODUCT_BUNDLE_IDENTIFIER = elegracer.NetSpeedMonitor;
395395
PRODUCT_NAME = "$(TARGET_NAME)";
396396
SWIFT_OBJC_BRIDGING_HEADER = "NetSpeedMonitor/NetSpeedMonitor-Bridging-Header.h";
@@ -413,7 +413,7 @@
413413
"$(inherited)",
414414
"@executable_path/../Frameworks",
415415
);
416-
MARKETING_VERSION = 1.4;
416+
MARKETING_VERSION = 1.5;
417417
PRODUCT_BUNDLE_IDENTIFIER = elegracer.NetSpeedMonitor;
418418
PRODUCT_NAME = "$(TARGET_NAME)";
419419
SWIFT_OBJC_BRIDGING_HEADER = "NetSpeedMonitor/NetSpeedMonitor-Bridging-Header.h";

NetSpeedMonitor/AppDelegate.swift

+9-10
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,20 @@ class AppDelegate: NSObject, NSApplicationDelegate {
6161
var statusBarTextAttributes : [NSAttributedString.Key : Any] {
6262
let paragraphStyle = NSMutableParagraphStyle()
6363
paragraphStyle.alignment = .right
64+
paragraphStyle.maximumLineHeight = 10
65+
var map = [NSAttributedString.Key : Any]()
6466
if let font = NSFont(name: "SFMono-Regular", size: 9) {
65-
paragraphStyle.maximumLineHeight = 10
6667
paragraphStyle.paragraphSpacing = -5
67-
return [
68-
NSAttributedString.Key.font : font,
69-
NSAttributedString.Key.paragraphStyle: paragraphStyle
70-
] as [NSAttributedString.Key : Any]
68+
map[NSAttributedString.Key.font] = font
69+
if #available(macOS 11, *) {
70+
map[NSAttributedString.Key.baselineOffset] = -4
71+
}
7172
} else {
72-
paragraphStyle.maximumLineHeight = 10
7373
paragraphStyle.paragraphSpacing = -7
74-
return [
75-
NSAttributedString.Key.font : NSFont.monospacedDigitSystemFont(ofSize: 9, weight: .regular),
76-
NSAttributedString.Key.paragraphStyle: paragraphStyle
77-
] as [NSAttributedString.Key : Any]
74+
map[NSAttributedString.Key.font] = NSFont.monospacedDigitSystemFont(ofSize: 9, weight: .regular)
7875
}
76+
map[NSAttributedString.Key.paragraphStyle] = paragraphStyle
77+
return map
7978
}
8079

8180
func updateSpeed() {

0 commit comments

Comments
 (0)