mirror of
https://github.com/neon443/DesktopGoose2.git
synced 2026-11-30 12:44:52 +00:00
53 lines
1.1 KiB
Swift
53 lines
1.1 KiB
Swift
//
|
|
// GooseWindow.swift
|
|
// DesktopDuck
|
|
//
|
|
// Created by neon443 on 11/09/2025.
|
|
//
|
|
|
|
import Foundation
|
|
import Cocoa
|
|
|
|
class GooseWindow: NSWindow {
|
|
private var goose: Goose
|
|
private var angle: CGFloat = 90
|
|
var shown: Bool = false
|
|
private var x = 1
|
|
private var time: Timer?
|
|
|
|
init() {
|
|
goose = Goose()
|
|
super.init(
|
|
contentRect: NSRect(x: 0, y: 0, width: NSScreen.main!.frame.width, height: NSScreen.main!.frame.height),
|
|
styleMask: .borderless,
|
|
backing: .buffered,
|
|
defer: false
|
|
)
|
|
|
|
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"))
|
|
self.contentView?.addSubview(goose.view)
|
|
}
|
|
|
|
func showHide() {
|
|
if shown {
|
|
self.orderOut(nil)
|
|
} else {
|
|
self.orderFront(nil)
|
|
}
|
|
}
|
|
|
|
func setup() {
|
|
|
|
}
|
|
}
|
|
|