add goosewindow

This commit is contained in:
neon443
2025-09-12 05:57:59 +01:00
parent c4aaf31c2f
commit 019cebfe7a
4 changed files with 62 additions and 12 deletions

View File

@@ -7,7 +7,7 @@
objects = {
/* Begin PBXFileReference section */
A9B30BD82E73040800EB41F9 /* DesktopGoose2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DesktopGoose2.app; sourceTree = BUILT_PRODUCTS_DIR; };
A9B30BD82E73040800EB41F9 /* DesktopDuck.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DesktopDuck.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFileSystemSynchronizedRootGroup section */
@@ -40,7 +40,7 @@
A9B30BD92E73040800EB41F9 /* Products */ = {
isa = PBXGroup;
children = (
A9B30BD82E73040800EB41F9 /* DesktopGoose2.app */,
A9B30BD82E73040800EB41F9 /* DesktopDuck.app */,
);
name = Products;
sourceTree = "<group>";
@@ -48,9 +48,9 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
A9B30BD72E73040800EB41F9 /* DesktopGoose2 */ = {
A9B30BD72E73040800EB41F9 /* DesktopDuck */ = {
isa = PBXNativeTarget;
buildConfigurationList = A9B30BE42E73040900EB41F9 /* Build configuration list for PBXNativeTarget "DesktopGoose2" */;
buildConfigurationList = A9B30BE42E73040900EB41F9 /* Build configuration list for PBXNativeTarget "DesktopDuck" */;
buildPhases = (
A9B30BD42E73040800EB41F9 /* Sources */,
A9B30BD52E73040800EB41F9 /* Frameworks */,
@@ -63,11 +63,11 @@
fileSystemSynchronizedGroups = (
A9B30BDA2E73040800EB41F9 /* DesktopGoose2 */,
);
name = DesktopGoose2;
name = DesktopDuck;
packageProductDependencies = (
);
productName = DesktopGoose2;
productReference = A9B30BD82E73040800EB41F9 /* DesktopGoose2.app */;
productReference = A9B30BD82E73040800EB41F9 /* DesktopDuck.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
@@ -85,7 +85,7 @@
};
};
};
buildConfigurationList = A9B30BD32E73040800EB41F9 /* Build configuration list for PBXProject "DesktopGoose2" */;
buildConfigurationList = A9B30BD32E73040800EB41F9 /* Build configuration list for PBXProject "DesktopDuck" */;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
@@ -99,7 +99,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
A9B30BD72E73040800EB41F9 /* DesktopGoose2 */,
A9B30BD72E73040800EB41F9 /* DesktopDuck */,
);
};
/* End PBXProject section */
@@ -268,7 +268,7 @@
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 15.5;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.DesktopGoose2;
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.DesktopDuck;
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
SDKROOT = auto;
@@ -307,7 +307,7 @@
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 15.5;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.DesktopGoose2;
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.DesktopDuck;
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
SDKROOT = auto;
@@ -322,7 +322,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
A9B30BD32E73040800EB41F9 /* Build configuration list for PBXProject "DesktopGoose2" */ = {
A9B30BD32E73040800EB41F9 /* Build configuration list for PBXProject "DesktopDuck" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A9B30BE22E73040900EB41F9 /* Debug */,
@@ -331,7 +331,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
A9B30BE42E73040900EB41F9 /* Build configuration list for PBXNativeTarget "DesktopGoose2" */ = {
A9B30BE42E73040900EB41F9 /* Build configuration list for PBXNativeTarget "DesktopDuck" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A9B30BE52E73040900EB41F9 /* Debug */,

View File

@@ -12,6 +12,9 @@ struct DesktopGoose2App: App {
var body: some Scene {
WindowGroup {
ContentView()
.onAppear {
let x = GooseWindow()
}
}
}
}

View 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)
}
}
}