This commit is contained in:
diyaa 2026-07-26 22:08:49 +02:00
parent e973d850ed
commit f9e74d2dfe
2 changed files with 19 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import AppKit import AppKit
import AppKit
import SwiftUI import SwiftUI
@main @main
@ -6,11 +7,28 @@ struct FchatiApp: App {
var body: some Scene { var body: some Scene {
MenuBarExtra("Fchati", systemImage: "message") { MenuBarExtra("Fchati", systemImage: "message") {
RootView() RootView()
.background(WindowConfigurator())
} }
.menuBarExtraStyle(.window) .menuBarExtraStyle(.window)
} }
} }
// Prevents the popover from closing when clicking outside.
private struct WindowConfigurator: NSViewRepresentable {
func makeNSView(context: Context) -> NSView {
let view = NSView()
DispatchQueue.main.async {
guard let window = view.window else { return }
window.level = .floating
window.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
window.isMovableByWindowBackground = false
}
return view
}
func updateNSView(_ nsView: NSView, context: Context) {}
}
enum AppTab: String, CaseIterable, Identifiable { enum AppTab: String, CaseIterable, Identifiable {
case chat = "Chat" case chat = "Chat"
case pairing = "Pairing" case pairing = "Pairing"

View File

@ -209,6 +209,7 @@ final class AppSession: ObservableObject {
KeychainStore.peerID = peerID KeychainStore.peerID = peerID
KeychainStore.peerName = peerName KeychainStore.peerName = peerName
state = .connected(peerID: peerID, peerName: peerName) state = .connected(peerID: peerID, peerName: peerName)
NotificationManager.shared.notify(from: "Fchati", body: "\(peerName) connected")
} }
case "read": case "read":