From 019cebfe7a87dd21012b5cfeca7d612ada7cb5d6 Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Fri, 12 Sep 2025 05:57:59 +0100 Subject: [PATCH] add goosewindow --- .../project.pbxproj | 24 +++++----- .../contents.xcworkspacedata | 0 DesktopGoose2/DesktopGoose2App.swift | 3 ++ DesktopGoose2/GooseWindow.swift | 47 +++++++++++++++++++ 4 files changed, 62 insertions(+), 12 deletions(-) rename {DesktopGoose2.xcodeproj => DesktopDuck.xcodeproj}/project.pbxproj (94%) rename {DesktopGoose2.xcodeproj => DesktopDuck.xcodeproj}/project.xcworkspace/contents.xcworkspacedata (100%) create mode 100644 DesktopGoose2/GooseWindow.swift diff --git a/DesktopGoose2.xcodeproj/project.pbxproj b/DesktopDuck.xcodeproj/project.pbxproj similarity index 94% rename from DesktopGoose2.xcodeproj/project.pbxproj rename to DesktopDuck.xcodeproj/project.pbxproj index 3a9c47f..66830b0 100644 --- a/DesktopGoose2.xcodeproj/project.pbxproj +++ b/DesktopDuck.xcodeproj/project.pbxproj @@ -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 = ""; @@ -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 */, diff --git a/DesktopGoose2.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/DesktopDuck.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from DesktopGoose2.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to DesktopDuck.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/DesktopGoose2/DesktopGoose2App.swift b/DesktopGoose2/DesktopGoose2App.swift index 39c6ec0..e351ac3 100644 --- a/DesktopGoose2/DesktopGoose2App.swift +++ b/DesktopGoose2/DesktopGoose2App.swift @@ -12,6 +12,9 @@ struct DesktopGoose2App: App { var body: some Scene { WindowGroup { ContentView() + .onAppear { + let x = GooseWindow() + } } } } diff --git a/DesktopGoose2/GooseWindow.swift b/DesktopGoose2/GooseWindow.swift new file mode 100644 index 0000000..846472f --- /dev/null +++ b/DesktopGoose2/GooseWindow.swift @@ -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) + } + } +}