skyhigh: shows a window above everythign else

now just shows wherre the mouse can be warped
This commit is contained in:
neon443
2025-05-29 11:21:08 +01:00
parent 6a68713ad5
commit 853fc2a2db
4 changed files with 85 additions and 2 deletions

52
DockPhobia/SkyHigh.swift Normal file
View File

@@ -0,0 +1,52 @@
//
// SkyHigh.swift
// DockPhobia
//
// Created by neon443 on 28/05/2025.
//
import Foundation
import Cocoa
class SkyHigh {
private var window: NSWindow
private var x = 1
private var timer: Timer?
init() {
guard let screen = NSScreen.main?.frame else { fatalError() }
self.window = NSWindow(
contentRect: CGRect(
x: screen.width*0.05,
y: screen.height*0.1,
width: screen.width*0.9,
height: screen.height*0.8
),
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.statusBar + 1
window.ignoresMouseEvents = true
window.hasShadow = true
window.makeKeyAndOrderFront(nil)
window.setFrameOrigin(NSPoint(x: screen.width*0.05, y: screen.height*0.1))
}
func move() {
x = 1
timer?.invalidate()
timer = Timer(timeInterval: 0.01, repeats: true) { [weak self] _ in
guard let self = self else { return }
guard x < 1001 else {
timer?.invalidate()
return
}
self.window.setFrameOrigin(NSPoint(x: 1000-self.x, y: 1000-self.x))
self.x += 1
}
RunLoop.current.add(timer!, forMode: .common)
}
}