mirror of
https://github.com/neon443/DesktopGoose2.git
synced 2026-03-11 05:19:14 +00:00
rename to desktopduck
This commit is contained in:
47
DesktopDuck/GooseWindow.swift
Normal file
47
DesktopDuck/GooseWindow.swift
Normal file
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// GooseWindow.swift
|
||||
// DesktopGoose2
|
||||
//
|
||||
// Created by neon443 on 11/09/2025.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Cocoa
|
||||
|
||||
class GooseWindow {
|
||||
private var window: NSWindow
|
||||
var shown: Bool = false
|
||||
private var x = 1
|
||||
private var time: Timer?
|
||||
|
||||
init() {
|
||||
self.window = NSWindow(
|
||||
contentRect: CGRect(
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: NSScreen.main!.frame.width,
|
||||
height: NSScreen.main!.frame.width
|
||||
),
|
||||
styleMask: .borderless,
|
||||
backing: .buffered,
|
||||
defer: false
|
||||
)
|
||||
window.backgroundColor = .init(srgbRed: 1, green: 1, blue: 1, alpha: 0.1)
|
||||
window.contentView = NSImageView()
|
||||
window.isOpaque = false
|
||||
window.level = NSWindow.Level.screenSaver + 1
|
||||
window.ignoresMouseEvents = true
|
||||
window.hasShadow = false
|
||||
window.collectionBehavior = NSWindow.CollectionBehavior.canJoinAllSpaces.union(.canJoinAllApplications).union(.stationary)
|
||||
|
||||
showHide()
|
||||
}
|
||||
|
||||
func showHide() {
|
||||
if shown {
|
||||
window.orderOut(nil)
|
||||
} else {
|
||||
window.orderFront(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user