mirror of
https://github.com/neon443/DesktopGoose2.git
synced 2026-11-30 12:44:52 +00:00
minor refactoring
This commit is contained in:
5 files changed
+32
-20
No files matched your search
@@ -288,6 +288,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
|
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
@@ -303,8 +304,9 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 13;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.s;
|
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.DesktopDuck;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
REGISTER_APP_GROUPS = YES;
|
REGISTER_APP_GROUPS = YES;
|
||||||
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||||
@@ -321,6 +323,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
|
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
@@ -336,8 +339,9 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 13;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.s;
|
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.DesktopDuck;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
REGISTER_APP_GROUPS = YES;
|
REGISTER_APP_GROUPS = YES;
|
||||||
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// AppDelegate.swift
|
// AppDelegate.swift
|
||||||
// s
|
// DesktopDuck
|
||||||
//
|
//
|
||||||
// Created by neon443 on 11/09/2025.
|
// Created by neon443 on 11/09/2025.
|
||||||
//
|
//
|
||||||
@@ -9,12 +9,14 @@ import Cocoa
|
|||||||
|
|
||||||
@main
|
@main
|
||||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
|
var gooseWindow: GooseWindow?
|
||||||
|
|
||||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||||
// Insert code here to initialize your application
|
// Insert code here to initialize your application
|
||||||
// let window = NSWindow(contentRect: NSScreen.main!.frame, styleMask: .borderless, backing: .buffered, defer: false)
|
// let window = NSWindow(contentRect: NSScreen.main!.frame, styleMask: .borderless, backing: .buffered, defer: false)
|
||||||
// window.backgroundColor = .init(srgbRed: 1, green: 1, blue: 1, alpha: 0.1)
|
// window.backgroundColor = .init(srgbRed: 1, green: 1, blue: 1, alpha: 0.1)
|
||||||
// window.orderFront(nil)
|
// window.orderFront(nil)
|
||||||
let x = GooseWindow()
|
gooseWindow = GooseWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
func applicationWillTerminate(_ aNotification: Notification) {
|
func applicationWillTerminate(_ aNotification: Notification) {
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ class Goose: NSViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setup() {
|
func setup() {
|
||||||
gooseView.frame = NSRect(x: 100, y: 100, width: 25, height: 25)
|
gooseView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
gooseView.frame = NSRect(x: 100, y: 100, width: 50, height: 50)
|
||||||
self.view.addSubview(gooseView)
|
self.view.addSubview(gooseView)
|
||||||
|
|
||||||
let bodyView = NSImageView(image: NSImage(named: "body")!)
|
let bodyView = NSImageView(image: NSImage(named: "body")!)
|
||||||
@@ -41,10 +42,15 @@ class Goose: NSViewController {
|
|||||||
gooseView.addSubview(neckView)
|
gooseView.addSubview(neckView)
|
||||||
neckView.translatesAutoresizingMaskIntoConstraints = false
|
neckView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
neckView.rotate(byDegrees: 90)
|
neckView.rotate(byDegrees: 90)
|
||||||
|
neckView.frame = NSRect(x: 0, y: 0, width: 30, height: 30)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
neckView.widthAnchor.constraint(equalToConstant: 25),
|
neckView.leftAnchor.constraint(equalTo: bodyView.leftAnchor),
|
||||||
neckView.heightAnchor.constraint(equalToConstant: 25)
|
neckView.bottomAnchor.constraint(equalTo: bodyView.bottomAnchor),
|
||||||
|
neckView.widthAnchor.constraint(equalToConstant: 30),
|
||||||
|
neckView.heightAnchor.constraint(equalToConstant: 30)
|
||||||
])
|
])
|
||||||
|
bodyView.alphaValue = 0.5
|
||||||
|
neckView.alphaValue = 0.5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
class GooseWindow {
|
class GooseWindow: NSWindow {
|
||||||
private var window: NSWindow
|
|
||||||
private var goose: Goose
|
private var goose: Goose
|
||||||
private var angle: CGFloat = 90
|
private var angle: CGFloat = 90
|
||||||
var shown: Bool = false
|
var shown: Bool = false
|
||||||
@@ -18,30 +17,31 @@ class GooseWindow {
|
|||||||
|
|
||||||
init() {
|
init() {
|
||||||
goose = Goose()
|
goose = Goose()
|
||||||
self.window = NSWindow(
|
super.init(
|
||||||
contentRect: CGRect(x: 0, y: 0, width: NSScreen.main!.frame.width, height: NSScreen.main!.frame.width),
|
contentRect: NSRect(x: 0, y: 0, width: NSScreen.main!.frame.width, height: NSScreen.main!.frame.height),
|
||||||
styleMask: .borderless,
|
styleMask: .borderless,
|
||||||
backing: .buffered,
|
backing: .buffered,
|
||||||
defer: false
|
defer: false
|
||||||
)
|
)
|
||||||
window.backgroundColor = .init(srgbRed: 1, green: 1, blue: 1, alpha: 0.1)
|
|
||||||
window.isOpaque = false
|
self.backgroundColor = .init(srgbRed: 1, green: 1, blue: 1, alpha: 0.1)
|
||||||
window.level = NSWindow.Level.screenSaver + 1
|
self.isOpaque = false
|
||||||
window.ignoresMouseEvents = true
|
self.level = NSWindow.Level.screenSaver + 1
|
||||||
window.hasShadow = false
|
self.ignoresMouseEvents = true
|
||||||
window.collectionBehavior = NSWindow.CollectionBehavior.canJoinAllApplications.union(.stationary).union(.canJoinAllSpaces)
|
self.hasShadow = false
|
||||||
|
self.collectionBehavior = NSWindow.CollectionBehavior.canJoinAllApplications.union(.stationary).union(.canJoinAllSpaces)
|
||||||
|
|
||||||
showHide()
|
showHide()
|
||||||
|
|
||||||
// window.contentView?.addSubview(NSTextField(labelWithString: "hi"))
|
// window.contentView?.addSubview(NSTextField(labelWithString: "hi"))
|
||||||
window.contentView?.addSubview(goose.view)
|
self.contentView?.addSubview(goose.view)
|
||||||
}
|
}
|
||||||
|
|
||||||
func showHide() {
|
func showHide() {
|
||||||
if shown {
|
if shown {
|
||||||
window.orderOut(nil)
|
self.orderOut(nil)
|
||||||
} else {
|
} else {
|
||||||
window.orderFront(nil)
|
self.orderFront(nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.