Skip to content

Commit 9f8ce61

Browse files
committed
add: app: status item: initial code
1 parent 551b37f commit 9f8ce61

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

MewNotch.xcodeproj/project.pbxproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@
266266
ENABLE_HARDENED_RUNTIME = YES;
267267
ENABLE_PREVIEWS = YES;
268268
GENERATE_INFOPLIST_FILE = YES;
269+
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
269270
INFOPLIST_KEY_LSBackgroundOnly = YES;
270271
INFOPLIST_KEY_NSHumanReadableCopyright = "";
271272
INFOPLIST_KEY_UIUserInterfaceStyle = Dark;
@@ -274,7 +275,7 @@
274275
"@executable_path/../Frameworks",
275276
);
276277
MACOSX_DEPLOYMENT_TARGET = 14.0;
277-
MARKETING_VERSION = 1.0;
278+
MARKETING_VERSION = 0.1;
278279
PRODUCT_BUNDLE_IDENTIFIER = com.monuk7735.mew.notch;
279280
PRODUCT_NAME = "$(TARGET_NAME)";
280281
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -296,6 +297,7 @@
296297
ENABLE_HARDENED_RUNTIME = YES;
297298
ENABLE_PREVIEWS = YES;
298299
GENERATE_INFOPLIST_FILE = YES;
300+
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
299301
INFOPLIST_KEY_LSBackgroundOnly = YES;
300302
INFOPLIST_KEY_NSHumanReadableCopyright = "";
301303
INFOPLIST_KEY_UIUserInterfaceStyle = Dark;
@@ -304,7 +306,7 @@
304306
"@executable_path/../Frameworks",
305307
);
306308
MACOSX_DEPLOYMENT_TARGET = 14.0;
307-
MARKETING_VERSION = 1.0;
309+
MARKETING_VERSION = 0.1;
308310
PRODUCT_BUNDLE_IDENTIFIER = com.monuk7735.mew.notch;
309311
PRODUCT_NAME = "$(TARGET_NAME)";
310312
SWIFT_EMIT_LOC_STRINGS = YES;

MewNotch/MewAppDelegate.swift

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import MediaKeyTap
1212
class MewAppDelegate: NSObject, NSApplicationDelegate {
1313

1414
@Environment(\.openWindow) var openWindow
15+
@Environment(\.openSettings) var openSettingsWindow
1516

1617
var windows: [NSScreen: NSWindow] = [:]
1718

@@ -74,33 +75,39 @@ class MewAppDelegate: NSObject, NSApplicationDelegate {
7475
}
7576

7677
func createStatusItem() {
77-
let item = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
78+
let statusItem = NSStatusBar.system.statusItem(
79+
withLength: NSStatusItem.squareLength
80+
)
7881

7982
let menu = NSMenu()
8083

8184
menu.items = [
8285
NSMenuItem(
83-
title: "Quit App",
86+
title: "Settings",
87+
action: #selector(openSettings),
88+
keyEquivalent: "S"
89+
),
90+
NSMenuItem(
91+
title: "Quit",
8492
action: #selector(quitApp),
8593
keyEquivalent: "Q"
8694
),
8795
]
8896

89-
item.menu = menu
97+
// statusItem.menu = menu
9098

91-
item.isVisible = true
92-
93-
if let button = item.button {
94-
// button.image = NSImage(named: "muse")
95-
button.image = NSStatusBarButton.init(checkboxWithTitle: "", target: nil, action: nil).image
99+
if let button = statusItem.button {
100+
button.image = NSImage(
101+
named: "Speaker"
102+
)
96103
button.image?.isTemplate = true
97104

98105
button.identifier = NSUserInterfaceItemIdentifier("MewStatusItem")
99106
}
100107
}
101108

102109
@objc func openSettings() {
103-
110+
openSettingsWindow()
104111
}
105112

106113
@objc func quitApp() {

0 commit comments

Comments
 (0)