minor refactoring

This commit is contained in:
Nihaal Sharma committed 2026-10-17 00:35:34 +01:00
1 parent 93a02f9a48
commit 49cf17b99a
5 files changed
+32 -20

No files matched your search

+13 -13
View File
@@ -8,8 +8,7 @@
import Foundation
import Cocoa
class GooseWindow {
private var window: NSWindow
class GooseWindow: NSWindow {
private var goose: Goose
private var angle: CGFloat = 90
var shown: Bool = false
@@ -18,30 +17,31 @@ class GooseWindow {
init() {
goose = Goose()
self.window = NSWindow(
contentRect: CGRect(x: 0, y: 0, width: NSScreen.main!.frame.width, height: NSScreen.main!.frame.width),
super.init(
contentRect: NSRect(x: 0, y: 0, width: NSScreen.main!.frame.width, height: NSScreen.main!.frame.height),
styleMask: .borderless,
backing: .buffered,
defer: false
)
window.backgroundColor = .init(srgbRed: 1, green: 1, blue: 1, alpha: 0.1)
window.isOpaque = false
window.level = NSWindow.Level.screenSaver + 1
window.ignoresMouseEvents = true
window.hasShadow = false
window.collectionBehavior = NSWindow.CollectionBehavior.canJoinAllApplications.union(.stationary).union(.canJoinAllSpaces)
self.backgroundColor = .init(srgbRed: 1, green: 1, blue: 1, alpha: 0.1)
self.isOpaque = false
self.level = NSWindow.Level.screenSaver + 1
self.ignoresMouseEvents = true
self.hasShadow = false
self.collectionBehavior = NSWindow.CollectionBehavior.canJoinAllApplications.union(.stationary).union(.canJoinAllSpaces)
showHide()
// window.contentView?.addSubview(NSTextField(labelWithString: "hi"))
window.contentView?.addSubview(goose.view)
self.contentView?.addSubview(goose.view)
}
func showHide() {
if shown {
window.orderOut(nil)
self.orderOut(nil)
} else {
window.orderFront(nil)
self.orderFront(nil)
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.