Native macOS app for posting to Mastodon, WordPress (self-hosted), and Micro.blog. Features: global hotkey (Ctrl+Option+Cmd+T), multiple accounts with selection, image attachments (up to 4, drag-and-drop), floating panel UI, Keychain storage.
34 lines
970 B
Swift
34 lines
970 B
Swift
import AppKit
|
|
import SwiftUI
|
|
|
|
final class FloatingPanel: NSPanel {
|
|
|
|
init(contentView: some View) {
|
|
super.init(
|
|
contentRect: NSRect(x: 0, y: 0, width: 440, height: 380),
|
|
styleMask: [.titled, .closable, .fullSizeContentView, .nonactivatingPanel],
|
|
backing: .buffered,
|
|
defer: false
|
|
)
|
|
|
|
isFloatingPanel = true
|
|
level = .floating
|
|
titleVisibility = .hidden
|
|
titlebarAppearsTransparent = true
|
|
isMovableByWindowBackground = true
|
|
isReleasedWhenClosed = false
|
|
animationBehavior = .utilityWindow
|
|
hidesOnDeactivate = false
|
|
collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
|
|
backgroundColor = .windowBackgroundColor
|
|
|
|
self.contentView = NSHostingView(rootView: contentView)
|
|
center()
|
|
}
|
|
|
|
override var canBecomeKey: Bool { true }
|
|
|
|
override func cancelOperation(_ sender: Any?) {
|
|
close()
|
|
}
|
|
}
|