Skip to content

Commit c3aa686

Browse files
committed
Preserve accessory launch for packaged app
1 parent 11aff9e commit c3aa686

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

Scripts/package_app.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ cat > "$CONTENTS_DIR/Info.plist" <<'PLIST'
5252
<string>1</string>
5353
<key>LSMinimumSystemVersion</key>
5454
<string>14.0</string>
55+
<key>LSUIElement</key>
56+
<true/>
5557
<key>NSPrincipalClass</key>
5658
<string>NSApplication</string>
5759
</dict>

Sources/CrawlBar/App/AppDelegate.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ final class CrawlBarAppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate
194194
private func showInApplicationSwitcher() {
195195
// Settings needs regular activation so macOS treats the window like a normal app window for focus and accessibility.
196196
NSApplication.shared.setActivationPolicy(.regular)
197-
NSApplication.shared.activate()
197+
NSApplication.shared.unhide(nil)
198+
NSApplication.shared.activate(ignoringOtherApps: true)
198199
}
199200

200201
private func hideFromApplicationSwitcher() {

Sources/CrawlBar/App/CrawlBarApp.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ enum CrawlBarApp {
77
let app = NSApplication.shared
88
let delegate = CrawlBarAppDelegate()
99
app.delegate = delegate
10-
app.setActivationPolicy(.regular)
10+
// Launch as a menu-bar app; Settings switches to regular activation while its window is open.
11+
app.setActivationPolicy(.accessory)
1112
app.run()
1213
}
1314
}

0 commit comments

Comments
 (0)