ارفع راسك فوق انته سوري حر ... :green_heart::green_heart:

Skip to content
Snippets Groups Projects
Commit dd0cc057 authored by George's avatar George
Browse files

remove all folders that we dont need

parent ca1fa2f8
Branches
No related tags found
No related merge requests found
Showing
with 0 additions and 651 deletions
No preview for this file type
import AppKit
import ApplicationLibrary
import Foundation
import Libbox
import Library
open class ApplicationDelegate: NSObject, NSApplicationDelegate {
public func applicationDidFinishLaunching(_: Notification) {
NSLog("Here I stand")
LibboxSetup(FilePath.sharedDirectory.relativePath, FilePath.workingDirectory.relativePath, FilePath.cacheDirectory.relativePath, false)
let event = NSAppleEventManager.shared().currentAppleEvent
let launchedAsLogInItem =
event?.eventID == kAEOpenApplication &&
event?.paramDescriptor(forKeyword: keyAEPropData)?.enumCodeValue == keyAELaunchedAsLogInItem
if SharedPreferences.inDebug || !launchedAsLogInItem || !SharedPreferences.showMenuBarExtra.getBlocking() || !SharedPreferences.menuBarExtraInBackground.getBlocking() {
NSApp.setActivationPolicy(.regular)
NSApp.activate(ignoringOtherApps: true)
} else {
NSApp.windows.first?.close()
}
Task {
do {
try await ProfileUpdateTask.configure()
if launchedAsLogInItem {
if await SharedPreferences.startedByUser.get() {
if let profile = try await ExtensionProfile.load() {
try await profile.start()
}
}
}
} catch {
NSLog("application setup error: \(error.localizedDescription)")
}
}
}
public func applicationShouldTerminateAfterLastWindowClosed(_: NSApplication) -> Bool {
SharedPreferences.inDebug || !SharedPreferences.menuBarExtraInBackground.getBlocking()
}
public func applicationShouldHandleReopen(_: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
if !flag, NSApp.activationPolicy() == .accessory {
NSApp.setActivationPolicy(.regular)
NSRunningApplication.runningApplications(withBundleIdentifier: "com.apple.dock").first?.activate()
}
return true
}
}
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "apple-16 1x.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "apple-16 2x.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "apple-32 1x.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "apple-32 2x 1.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "apple-128 1x.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "apple-128 2x.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "apple-256 1x.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "apple-256 2x.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "apple-512 1x.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "apple-512 2x.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
MacLibrary/Assets.xcassets/AppIcon.appiconset/apple-128 1x.png

278 KiB

MacLibrary/Assets.xcassets/AppIcon.appiconset/apple-128 2x.png

286 KiB

MacLibrary/Assets.xcassets/AppIcon.appiconset/apple-16 1x.png

273 KiB

MacLibrary/Assets.xcassets/AppIcon.appiconset/apple-16 2x.png

273 KiB

MacLibrary/Assets.xcassets/AppIcon.appiconset/apple-256 1x.png

286 KiB

MacLibrary/Assets.xcassets/AppIcon.appiconset/apple-256 2x.png

305 KiB

MacLibrary/Assets.xcassets/AppIcon.appiconset/apple-32 1x.png

272 KiB

MacLibrary/Assets.xcassets/AppIcon.appiconset/apple-32 2x 1.png

274 KiB

MacLibrary/Assets.xcassets/AppIcon.appiconset/apple-512 1x.png

305 KiB

MacLibrary/Assets.xcassets/AppIcon.appiconset/apple-512 2x.png

340 KiB

{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"symbol-rendering-intent" : "template"
},
"symbols" : [
{
"filename" : "menu_icon.svg",
"idiom" : "universal"
}
]
}
This diff is collapsed.
File deleted
import ApplicationLibrary
import Library
import SwiftUI
public struct MacApplication: Scene {
@State private var showMenuBarExtra = false
@State private var isMenuPresented = false
@StateObject private var environments = ExtensionEnvironments()
public init() {}
public var body: some Scene {
Window("sing-box", id: "main", content: {
MainView()
.onAppear {
Task {
await initialize()
}
}
.environment(\.showMenuBarExtra, $showMenuBarExtra)
.environmentObject(environments)
})
.commands {
if showMenuBarExtra {
CommandGroup(replacing: .appTermination) {
Button("Quit sing-box") {
hide(closeApp: true)
}
.keyboardShortcut("q", modifiers: [.command])
}
CommandGroup(replacing: .saveItem) {
Button("Close") {
hide(closeApp: false)
}
.keyboardShortcut("w", modifiers: [.command])
}
}
SidebarCommands()
CommandGroup(replacing: .appSettings) {
Button("Settings") {
environments.openSettings.send()
}
.keyboardShortcut(",", modifiers: [.command])
}
}
MenuBarExtra(isInserted: $showMenuBarExtra) {
MenuView(isMenuPresented: $isMenuPresented)
.environmentObject(environments)
} label: {
Image("MenuIcon")
}
.menuBarExtraStyle(.window)
.menuBarExtraAccess(isPresented: $isMenuPresented)
}
private func initialize() async {
showMenuBarExtra = await SharedPreferences.showMenuBarExtra.get()
}
private func hide(closeApp: Bool) {
Task {
if await SharedPreferences.menuBarExtraInBackground.get() {
hide0(closeApp: closeApp)
} else {
if closeApp {
NSApp.terminate(nil)
} else {
NSApp.keyWindow?.close()
}
}
}
}
private func hide0(closeApp: Bool) {
if closeApp || NSApp.keyWindow?.identifier?.rawValue == "main" {
let transformState = ProcessApplicationTransformState(kProcessTransformToUIElementApplication)
var psn = ProcessSerialNumber(highLongOfPSN: 0, lowLongOfPSN: UInt32(kCurrentProcess))
TransformProcessType(&psn, transformState)
NSApp.setActivationPolicy(.accessory)
}
NSApp.keyWindow?.close()
}
}
import Foundation
public class MacLibrary {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment