mirror of
https://github.com/neon443/DesktopGoose2.git
synced 2026-03-11 05:19:14 +00:00
add goosewindow
This commit is contained in:
@@ -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 */,
|
||||
@@ -12,6 +12,9 @@ struct DesktopGoose2App: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
.onAppear {
|
||||
let x = GooseWindow()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
47
DesktopGoose2/GooseWindow.swift
Normal file
47
DesktopGoose2/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