Skip to content

Commit 3576dc1

Browse files
committed
start at login
1 parent ca1631f commit 3576dc1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Flitro/FlitroApp.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ struct ContentView: View {
4141
selectedContextID: $selectedContextID
4242
)
4343
.onAppear {
44+
if ProcessInfo.processInfo.arguments.contains("-NSApplicationIsLoginItem") {
45+
if let window = NSApp.windows.first {
46+
window.orderOut(nil)
47+
NSApp.setActivationPolicy(.accessory)
48+
}
49+
}
4450
if selectedContextID == nil, let first = contextManager.contexts.first {
4551
selectedContextID = first.id
4652
}

Flitro/SettingsView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ struct SettingsView: View {
99
Toggle(isOn: $startAtLogin) {
1010
Text("Start Flitro at login")
1111
}
12-
.onChange(of: startAtLogin) { value in
13-
setLaunchAtLogin(enabled: value)
12+
.onChange(of: startAtLogin) {
13+
setLaunchAtLogin(enabled: startAtLogin)
1414
}
1515
}
1616
.padding()

0 commit comments

Comments
 (0)