From f9e74d2dfeb790365a2590e3541339ed262d9f46 Mon Sep 17 00:00:00 2001 From: diyaa Date: Sun, 26 Jul 2026 22:08:49 +0200 Subject: [PATCH] Update --- FchatiApp/Sources/FchatiApp/FchatiApp.swift | 18 ++++++++++++++++++ .../Sources/FchatiApp/Session/AppSession.swift | 1 + 2 files changed, 19 insertions(+) diff --git a/FchatiApp/Sources/FchatiApp/FchatiApp.swift b/FchatiApp/Sources/FchatiApp/FchatiApp.swift index 4f3c049..66e39ba 100644 --- a/FchatiApp/Sources/FchatiApp/FchatiApp.swift +++ b/FchatiApp/Sources/FchatiApp/FchatiApp.swift @@ -1,4 +1,5 @@ import AppKit +import AppKit import SwiftUI @main @@ -6,11 +7,28 @@ struct FchatiApp: App { var body: some Scene { MenuBarExtra("Fchati", systemImage: "message") { RootView() + .background(WindowConfigurator()) } .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 { case chat = "Chat" case pairing = "Pairing" diff --git a/FchatiApp/Sources/FchatiApp/Session/AppSession.swift b/FchatiApp/Sources/FchatiApp/Session/AppSession.swift index cdcd5b5..52dcb05 100644 --- a/FchatiApp/Sources/FchatiApp/Session/AppSession.swift +++ b/FchatiApp/Sources/FchatiApp/Session/AppSession.swift @@ -209,6 +209,7 @@ final class AppSession: ObservableObject { KeychainStore.peerID = peerID KeychainStore.peerName = peerName state = .connected(peerID: peerID, peerName: peerName) + NotificationManager.shared.notify(from: "Fchati", body: "\(peerName) connected") } case "read":