added mouse tracking, jank ui, and an amazing icon
@@ -23,6 +23,19 @@
|
|||||||
};
|
};
|
||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
|
A98E7EA02D836FBB0004DA00 /* Embed XPC Services */ = {
|
||||||
|
isa = PBXCopyFilesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
dstPath = "$(CONTENTS_FOLDER_PATH)/XPCServices";
|
||||||
|
dstSubfolderSpec = 16;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
name = "Embed XPC Services";
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
A91E849D2D82CF4100FC2E5F /* DockPhobia.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DockPhobia.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
A91E849D2D82CF4100FC2E5F /* DockPhobia.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DockPhobia.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
A91E84AE2D82CF4300FC2E5F /* DockPhobiaTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DockPhobiaTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
A91E84AE2D82CF4300FC2E5F /* DockPhobiaTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DockPhobiaTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
@@ -102,6 +115,7 @@
|
|||||||
A91E84992D82CF4100FC2E5F /* Sources */,
|
A91E84992D82CF4100FC2E5F /* Sources */,
|
||||||
A91E849A2D82CF4100FC2E5F /* Frameworks */,
|
A91E849A2D82CF4100FC2E5F /* Frameworks */,
|
||||||
A91E849B2D82CF4100FC2E5F /* Resources */,
|
A91E849B2D82CF4100FC2E5F /* Resources */,
|
||||||
|
A98E7EA02D836FBB0004DA00 /* Embed XPC Services */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@@ -392,6 +406,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;
|
||||||
|
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
|
||||||
CODE_SIGN_ENTITLEMENTS = DockPhobia/DockPhobia.entitlements;
|
CODE_SIGN_ENTITLEMENTS = DockPhobia/DockPhobia.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
@@ -401,7 +416,7 @@
|
|||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_KEY_LSUIElement = YES;
|
INFOPLIST_KEY_LSUIElement = NO;
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
@@ -420,6 +435,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;
|
||||||
|
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
|
||||||
CODE_SIGN_ENTITLEMENTS = DockPhobia/DockPhobia.entitlements;
|
CODE_SIGN_ENTITLEMENTS = DockPhobia/DockPhobia.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
@@ -429,7 +445,7 @@
|
|||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_KEY_LSUIElement = YES;
|
INFOPLIST_KEY_LSUIElement = NO;
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
|
|||||||
@@ -9,6 +9,11 @@
|
|||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</dict>
|
</dict>
|
||||||
|
<key>DockPhobiaHelper.xcscheme_^#shared#^_</key>
|
||||||
|
<dict>
|
||||||
|
<key>orderHint</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -1,51 +1,61 @@
|
|||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
|
"filename" : "DockPhobiaAppIcon 16.png",
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "1x",
|
"scale" : "1x",
|
||||||
"size" : "16x16"
|
"size" : "16x16"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "DockPhobiaAppIcon 33.png",
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "16x16"
|
"size" : "16x16"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "DockPhobiaAppIcon 32.png",
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "1x",
|
"scale" : "1x",
|
||||||
"size" : "32x32"
|
"size" : "32x32"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "DockPhobiaAppIcon 64.png",
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "32x32"
|
"size" : "32x32"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "DockPhobiaAppIcon 128.png",
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "1x",
|
"scale" : "1x",
|
||||||
"size" : "128x128"
|
"size" : "128x128"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "DockPhobiaAppIcon 256.png",
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "128x128"
|
"size" : "128x128"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "DockPhobiaAppIcon 257.png",
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "1x",
|
"scale" : "1x",
|
||||||
"size" : "256x256"
|
"size" : "256x256"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "DockPhobiaAppIcon 512.png",
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "256x256"
|
"size" : "256x256"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "DockPhobiaAppIcon 513.png",
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "1x",
|
"scale" : "1x",
|
||||||
"size" : "512x512"
|
"size" : "512x512"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "DockPhobiaAppIcon 1024.png",
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "512x512"
|
"size" : "512x512"
|
||||||
|
|||||||
|
After Width: | Height: | Size: 565 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 145 KiB |
|
After Width: | Height: | Size: 145 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
@@ -8,13 +8,24 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct ContentView: View {
|
struct ContentView: View {
|
||||||
|
@Binding var enabled: Bool
|
||||||
|
@State var mouseloc = NSEvent.mouseLocation
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack {
|
VStack {
|
||||||
|
Text("\(NSEvent.mouseLocation)")
|
||||||
|
Toggle("on", isOn: $enabled)
|
||||||
|
.toggleStyle(SwitchToggleStyle())
|
||||||
Image(systemName: "globe")
|
Image(systemName: "globe")
|
||||||
.imageScale(.large)
|
.imageScale(.large)
|
||||||
.foregroundStyle(.tint)
|
.foregroundStyle(.tint)
|
||||||
Text("Hello, world!")
|
Text("Hello, world!")
|
||||||
|
Spacer()
|
||||||
|
Button("df") {
|
||||||
|
startTrackingMouse()
|
||||||
|
}
|
||||||
|
Button("undf") {
|
||||||
|
stopTrackingMouse()
|
||||||
|
}
|
||||||
Button() {
|
Button() {
|
||||||
NSApp.terminate(nil)
|
NSApp.terminate(nil)
|
||||||
} label: {
|
} label: {
|
||||||
@@ -26,5 +37,5 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
ContentView()
|
ContentView(enabled: .constant(true))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,34 +5,122 @@
|
|||||||
// Created by neon443 on 13/03/2025.
|
// Created by neon443 on 13/03/2025.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import Cocoa
|
||||||
|
import CoreGraphics
|
||||||
|
|
||||||
|
//@main
|
||||||
|
//struct DockPhobiaApp: App {
|
||||||
|
// @State var enabled: Bool = true
|
||||||
|
// var body: some Scene {
|
||||||
|
// WindowGroup {
|
||||||
|
// ContentView(enabled: $enabled)
|
||||||
|
// }
|
||||||
|
// MenuBarExtra(
|
||||||
|
// "Menu Bar",
|
||||||
|
// systemImage: "cursorarrow\(enabled ? "" : ".slash")"
|
||||||
|
// ) {
|
||||||
|
//
|
||||||
|
// Button("One") {
|
||||||
|
// enabled.toggle()
|
||||||
|
// }
|
||||||
|
// .keyboardShortcut("1")
|
||||||
|
//// ContentView(enabled: $enabled)
|
||||||
|
//// .frame(width: 300, height: 200)
|
||||||
|
// }
|
||||||
|
// .menuBarExtraStyle(.window)
|
||||||
|
// }
|
||||||
|
//// NSEvent.addGlobalMonitorForEvents(matching: [.mouseMoved]) { event in
|
||||||
|
//// print("event:", event)
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
////struct DockPhobiaApp: App {
|
||||||
|
//// var body: some Scene {
|
||||||
|
//// WindowGroup {
|
||||||
|
//// ContentView()
|
||||||
|
//// }
|
||||||
|
//// }
|
||||||
|
////}
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
func moveDock() {
|
||||||
|
let process = Process()
|
||||||
|
process.executableURL = URL(fileURLWithPath: "/usr/bin/osascript")
|
||||||
|
|
||||||
|
if let scriptPath = Bundle.main.path(forResource: "/Users/neon443/Documents/Xcode/DockPhobia/DockPhobia/script.scpt", ofType: "scpt") {
|
||||||
|
process.arguments = [scriptPath]
|
||||||
|
|
||||||
|
do {
|
||||||
|
try process.run()
|
||||||
|
process.waitUntilExit()
|
||||||
|
} catch {
|
||||||
|
print("error")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print("error script not found")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@main
|
@main
|
||||||
struct DockPhobiaApp: App {
|
struct DockPhobiaApp: App {
|
||||||
|
enum DockPosition: String {
|
||||||
|
case left
|
||||||
|
case right
|
||||||
|
case bottom
|
||||||
|
}
|
||||||
|
|
||||||
|
@State var enabled: Bool = true
|
||||||
|
|
||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
MenuBarExtra(
|
WindowGroup {
|
||||||
"Menu Bar",
|
ContentView(enabled: $enabled)
|
||||||
systemImage: "star"
|
|
||||||
) {
|
|
||||||
ContentView()
|
|
||||||
.overlay(alignment: .topLeading) {
|
|
||||||
Button() {
|
|
||||||
NSApp.terminate(nil)
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "xmark.circle.fill")
|
|
||||||
.foregroundStyle(.blue)
|
|
||||||
}
|
}
|
||||||
.buttonStyle(PlainButtonStyle())
|
MenuBarExtra("Dock Phobia", systemImage: "cursorarrow\(enabled ? "" : ".slash")") {
|
||||||
|
Toggle(enabled ? "Enabled" : "Disabled", isOn: $enabled)
|
||||||
|
|
||||||
|
Divider()
|
||||||
|
Button("Right") {
|
||||||
|
moveDock()
|
||||||
}
|
}
|
||||||
.frame(width: 300, height: 180)
|
Button("Quit") {
|
||||||
|
NSApplication.shared.terminate(nil)
|
||||||
|
}
|
||||||
|
.keyboardShortcut("q")
|
||||||
}
|
}
|
||||||
.menuBarExtraStyle(.window)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//struct DockPhobiaApp: App {
|
|
||||||
// var body: some Scene {
|
// global event tap
|
||||||
// WindowGroup {
|
var eventTap: CFMachPort?
|
||||||
// ContentView()
|
|
||||||
// }
|
func startTrackingMouse() {
|
||||||
// }
|
let mask = CGEventMask(1 << CGEventType.mouseMoved.rawValue)
|
||||||
//}
|
|
||||||
|
//try creating event tap
|
||||||
|
eventTap = CGEvent.tapCreate(
|
||||||
|
tap: .cgSessionEventTap,
|
||||||
|
place: .headInsertEventTap,
|
||||||
|
options: CGEventTapOptions.defaultTap,
|
||||||
|
eventsOfInterest: mask,
|
||||||
|
callback: { (proxy, type, event, userInfo) -> Unmanaged<CGEvent>? in
|
||||||
|
let location = event.location
|
||||||
|
print("mouse at \(location)")
|
||||||
|
//TODO: add Dock moving here
|
||||||
|
return Unmanaged.passRetained(event)
|
||||||
|
},
|
||||||
|
userInfo: nil
|
||||||
|
)
|
||||||
|
|
||||||
|
//event tap started checking
|
||||||
|
if let eventTap = eventTap {
|
||||||
|
let runLoopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, eventTap, 0)
|
||||||
|
CFRunLoopAddSource(CFRunLoopGetMain(), runLoopSource, .commonModes)
|
||||||
|
CGEvent.tapEnable(tap: eventTap, enable: true)
|
||||||
|
|
||||||
|
print(" mouse tracking started!")
|
||||||
|
} else {
|
||||||
|
print(" failed to create event tap.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
5
DockPhobia/script.scpt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
tell application "System Events"
|
||||||
|
tell dock preferences
|
||||||
|
set screen edge to right
|
||||||
|
end tell
|
||||||
|
end tell
|
||||||