mirror of
https://github.com/neon443/DockPhobia.git
synced 2026-03-11 06:49:12 +00:00
Compare commits
11 Commits
853fc2a2db
...
58c834f1ed
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58c834f1ed | ||
|
|
84326f7e15 | ||
|
|
27e410ae76 | ||
|
|
d943415b98 | ||
|
|
83efb14bd5 | ||
|
|
d60d90bc60 | ||
|
|
4e55cc4516 | ||
|
|
1a0d3c2e38 | ||
|
|
e46edecec7 | ||
|
|
22c825dbb2 | ||
|
|
5357ce8443 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1 @@
|
|||||||
.DS_Store
|
**.DS_Store
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 77;
|
objectVersion = 63;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
A98C20C62DE614180008D61C /* DPSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98C20C52DE614180008D61C /* DPSettings.swift */; };
|
A98C20C62DE614180008D61C /* DPSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98C20C52DE614180008D61C /* DPSettings.swift */; };
|
||||||
A9C9AF812DE7776A0039D7A5 /* DockSide.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C9AF802DE777530039D7A5 /* DockSide.swift */; };
|
A9C9AF812DE7776A0039D7A5 /* DockSide.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C9AF802DE777530039D7A5 /* DockSide.swift */; };
|
||||||
A9C9AF832DE77CB70039D7A5 /* SkyHigh.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C9AF822DE77CB70039D7A5 /* SkyHigh.swift */; };
|
A9C9AF832DE77CB70039D7A5 /* SkyHigh.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C9AF822DE77CB70039D7A5 /* SkyHigh.swift */; };
|
||||||
|
A9C9B0682DE888B20039D7A5 /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C9B0672DE888B20039D7A5 /* Preferences.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
A98C20C52DE614180008D61C /* DPSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DPSettings.swift; sourceTree = "<group>"; };
|
A98C20C52DE614180008D61C /* DPSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DPSettings.swift; sourceTree = "<group>"; };
|
||||||
A9C9AF802DE777530039D7A5 /* DockSide.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DockSide.swift; sourceTree = "<group>"; };
|
A9C9AF802DE777530039D7A5 /* DockSide.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DockSide.swift; sourceTree = "<group>"; };
|
||||||
A9C9AF822DE77CB70039D7A5 /* SkyHigh.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SkyHigh.swift; sourceTree = "<group>"; };
|
A9C9AF822DE77CB70039D7A5 /* SkyHigh.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SkyHigh.swift; sourceTree = "<group>"; };
|
||||||
|
A9C9B0672DE888B20039D7A5 /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -52,6 +54,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
A94BEC0E2DE23E8500D4811D /* MainMenu.xib */,
|
A94BEC0E2DE23E8500D4811D /* MainMenu.xib */,
|
||||||
|
A9C9B0672DE888B20039D7A5 /* Preferences.swift */,
|
||||||
);
|
);
|
||||||
path = Views;
|
path = Views;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -126,6 +129,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
buildConfigurationList = A966B4D12DE0841000C721A5 /* Build configuration list for PBXProject "DockPhobia" */;
|
buildConfigurationList = A966B4D12DE0841000C721A5 /* Build configuration list for PBXProject "DockPhobia" */;
|
||||||
|
compatibilityVersion = "Xcode 12.0";
|
||||||
developmentRegion = en;
|
developmentRegion = en;
|
||||||
hasScannedForEncodings = 0;
|
hasScannedForEncodings = 0;
|
||||||
knownRegions = (
|
knownRegions = (
|
||||||
@@ -134,7 +138,6 @@
|
|||||||
);
|
);
|
||||||
mainGroup = A966B4CD2DE0841000C721A5;
|
mainGroup = A966B4CD2DE0841000C721A5;
|
||||||
minimizedProjectReferenceProxies = 1;
|
minimizedProjectReferenceProxies = 1;
|
||||||
preferredProjectObjectVersion = 77;
|
|
||||||
productRefGroup = A966B4D72DE0841000C721A5 /* Products */;
|
productRefGroup = A966B4D72DE0841000C721A5 /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
@@ -163,6 +166,7 @@
|
|||||||
files = (
|
files = (
|
||||||
A98C20C62DE614180008D61C /* DPSettings.swift in Sources */,
|
A98C20C62DE614180008D61C /* DPSettings.swift in Sources */,
|
||||||
A9C9AF832DE77CB70039D7A5 /* SkyHigh.swift in Sources */,
|
A9C9AF832DE77CB70039D7A5 /* SkyHigh.swift in Sources */,
|
||||||
|
A9C9B0682DE888B20039D7A5 /* Preferences.swift in Sources */,
|
||||||
A966B4F82DE0852900C721A5 /* MouseTracker.swift in Sources */,
|
A966B4F82DE0852900C721A5 /* MouseTracker.swift in Sources */,
|
||||||
A966B4F42DE0842500C721A5 /* AppDelegate.swift in Sources */,
|
A966B4F42DE0842500C721A5 /* AppDelegate.swift in Sources */,
|
||||||
A9C9AF812DE7776A0039D7A5 /* DockSide.swift in Sources */,
|
A9C9AF812DE7776A0039D7A5 /* DockSide.swift in Sources */,
|
||||||
|
|||||||
BIN
DockPhobia/.DS_Store
vendored
BIN
DockPhobia/.DS_Store
vendored
Binary file not shown.
@@ -55,6 +55,13 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||||||
keyEquivalent: ""
|
keyEquivalent: ""
|
||||||
)
|
)
|
||||||
menu.addItem(dockMoves)
|
menu.addItem(dockMoves)
|
||||||
|
|
||||||
|
let mouseMoves = NSMenuItem(
|
||||||
|
title: "Moved the cursor \(settings.settings.mouseMoves) time\(settings.settings.mouseMoves.plural)",
|
||||||
|
action: nil,
|
||||||
|
keyEquivalent: ""
|
||||||
|
)
|
||||||
|
menu.addItem(mouseMoves)
|
||||||
menu.addItem(NSMenuItem.separator())
|
menu.addItem(NSMenuItem.separator())
|
||||||
|
|
||||||
let moveMouseButton = NSMenuItem(
|
let moveMouseButton = NSMenuItem(
|
||||||
@@ -77,15 +84,15 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||||||
menu.addItem(NSMenuItem.separator())
|
menu.addItem(NSMenuItem.separator())
|
||||||
|
|
||||||
menu.addItem(NSMenuItem(
|
menu.addItem(NSMenuItem(
|
||||||
title: "Move Dock to left",
|
title: "Move Dock to the left",
|
||||||
action: #selector(moveDockObjcLeft),
|
action: #selector(moveDockObjcLeft),
|
||||||
keyEquivalent: ""))
|
keyEquivalent: ""))
|
||||||
menu.addItem(NSMenuItem(
|
menu.addItem(NSMenuItem(
|
||||||
title: "Move Dock to bottom",
|
title: "Move Dock to the bottom",
|
||||||
action: #selector(moveDockObjcBottom),
|
action: #selector(moveDockObjcBottom),
|
||||||
keyEquivalent: ""))
|
keyEquivalent: ""))
|
||||||
menu.addItem(NSMenuItem(
|
menu.addItem(NSMenuItem(
|
||||||
title: "Move Dock to right",
|
title: "Move Dock to the right",
|
||||||
action: #selector(moveDockObjcRight),
|
action: #selector(moveDockObjcRight),
|
||||||
keyEquivalent: ""))
|
keyEquivalent: ""))
|
||||||
menu.addItem(NSMenuItem.separator())
|
menu.addItem(NSMenuItem.separator())
|
||||||
|
|||||||
@@ -8,10 +8,83 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import AppKit
|
import AppKit
|
||||||
|
|
||||||
|
extension NSScreen {
|
||||||
|
static var mainFrame: CGRect {
|
||||||
|
main?.frame ?? CGRect(x: 0, y: 0, width: 1920, height: 1080)
|
||||||
|
}
|
||||||
|
static var mainFrameWidth: CGFloat {
|
||||||
|
main?.frame.width ?? 1920
|
||||||
|
}
|
||||||
|
static var mainFrameHeight: CGFloat {
|
||||||
|
main?.frame.height ?? 1080
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct DPSettings: Codable {
|
struct DPSettings: Codable {
|
||||||
var dockMoves: Int = 0
|
var dockMoves: Int
|
||||||
var checkFullscreen: Bool = false
|
var mouseMoves: Int
|
||||||
var moveMouseInstead: Bool = false
|
var checkFullscreen: Bool
|
||||||
|
var moveMouseInstead: Bool
|
||||||
|
|
||||||
|
var mouseInsetLeading: CGFloat {
|
||||||
|
NSScreen.mainFrameWidth*insetHorizontal
|
||||||
|
}
|
||||||
|
var mouseInsetBottom: CGFloat {
|
||||||
|
NSScreen.mainFrameHeight*insetVertical
|
||||||
|
}
|
||||||
|
var mouseInsetTop: CGFloat {
|
||||||
|
NSScreen.mainFrameHeight*(1-(insetVertical))
|
||||||
|
}
|
||||||
|
var mouseInsetTrailing: CGFloat {
|
||||||
|
NSScreen.mainFrameWidth*(1-(insetHorizontal))
|
||||||
|
}
|
||||||
|
|
||||||
|
var insetHorizontal: CGFloat
|
||||||
|
var insetVertical: CGFloat
|
||||||
|
|
||||||
|
var mouseMoveRect: CGRect {
|
||||||
|
return CGRect(
|
||||||
|
x: mouseInsetLeading,
|
||||||
|
y: mouseInsetBottom,
|
||||||
|
width: mouseInsetTrailing - mouseInsetLeading,
|
||||||
|
height: mouseInsetTop - mouseInsetBottom
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
init(
|
||||||
|
dockMoves: Int = 0,
|
||||||
|
mouseMoves: Int = 0,
|
||||||
|
checkFullscreen: Bool = false,
|
||||||
|
moveMouseInstead: Bool = false,
|
||||||
|
insetHorizontal: CGFloat = 0.05,
|
||||||
|
insetVertical: CGFloat = 0.1
|
||||||
|
) {
|
||||||
|
self.dockMoves = dockMoves
|
||||||
|
self.mouseMoves = mouseMoves
|
||||||
|
self.checkFullscreen = checkFullscreen
|
||||||
|
self.moveMouseInstead = moveMouseInstead
|
||||||
|
self.insetHorizontal = insetHorizontal
|
||||||
|
self.insetVertical = insetVertical
|
||||||
|
}
|
||||||
|
|
||||||
|
init(from decoder: any Decoder) throws {
|
||||||
|
let defaults = DPSettings()
|
||||||
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
dockMoves = try container.decodeIfPresent(Int.self, forKey: .dockMoves)
|
||||||
|
?? defaults.dockMoves
|
||||||
|
mouseMoves = try container.decodeIfPresent(Int.self, forKey: .mouseMoves)
|
||||||
|
?? defaults.mouseMoves
|
||||||
|
|
||||||
|
checkFullscreen = try container.decodeIfPresent(Bool.self, forKey: .checkFullscreen)
|
||||||
|
?? defaults.checkFullscreen
|
||||||
|
moveMouseInstead = try container.decodeIfPresent(Bool.self, forKey: .moveMouseInstead)
|
||||||
|
?? defaults.moveMouseInstead
|
||||||
|
|
||||||
|
insetHorizontal = try container.decodeIfPresent(CGFloat.self, forKey: .insetHorizontal)
|
||||||
|
?? defaults.insetHorizontal
|
||||||
|
insetVertical = try container.decodeIfPresent(CGFloat.self, forKey: .insetVertical)
|
||||||
|
?? defaults.insetVertical
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DPSettingsModel {
|
class DPSettingsModel {
|
||||||
|
|||||||
@@ -10,6 +10,23 @@ import AppKit
|
|||||||
import Cocoa
|
import Cocoa
|
||||||
import ApplicationServices
|
import ApplicationServices
|
||||||
|
|
||||||
|
extension NSEvent {
|
||||||
|
var mouseLocationCG: CGPoint {
|
||||||
|
var loc = NSEvent.mouseLocation
|
||||||
|
loc.y = NSScreen.mainFrameHeight - loc.y
|
||||||
|
return loc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGPoint {
|
||||||
|
var invertedForScreen: CGPoint {
|
||||||
|
return CGPoint(
|
||||||
|
x: self.x,
|
||||||
|
y: NSScreen.mainFrameHeight - self.y
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct Screen {
|
struct Screen {
|
||||||
var width: CGFloat
|
var width: CGFloat
|
||||||
var height: CGFloat
|
var height: CGFloat
|
||||||
@@ -23,22 +40,22 @@ class MouseTracker {
|
|||||||
var dockHeight: CGFloat = 0
|
var dockHeight: CGFloat = 0
|
||||||
|
|
||||||
var settings: DPSettingsModel
|
var settings: DPSettingsModel
|
||||||
var skyHigh = SkyHigh()
|
var skyHigh: SkyHigh
|
||||||
|
|
||||||
|
private var timer: Timer?
|
||||||
|
private var loopIteration: Double = 0
|
||||||
|
|
||||||
init(settings: DPSettingsModel) {
|
init(settings: DPSettingsModel) {
|
||||||
print(DockSide())
|
print(DockSide())
|
||||||
if let screen = NSScreen.main {
|
|
||||||
let rect = screen.frame
|
self.screen = Screen(
|
||||||
self.screen = Screen(
|
width: NSScreen.mainFrameWidth,
|
||||||
width: rect.width,
|
height: NSScreen.mainFrameHeight
|
||||||
height: rect.height
|
)
|
||||||
)
|
print(self.screen)
|
||||||
print(self.screen)
|
|
||||||
} else {
|
|
||||||
fatalError("no screen wtf???")
|
|
||||||
}
|
|
||||||
|
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
|
self.skyHigh = SkyHigh(settings: settings)
|
||||||
|
|
||||||
self.currentDockSide = .left
|
self.currentDockSide = .left
|
||||||
moveDock(.bottom)
|
moveDock(.bottom)
|
||||||
@@ -46,8 +63,13 @@ class MouseTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func checkMouse(_ event: NSEvent) {
|
func checkMouse(_ event: NSEvent) {
|
||||||
var location = NSEvent.mouseLocation
|
let location = event.mouseLocationCG
|
||||||
location.y = screen.height - location.y
|
#if DEBUG
|
||||||
|
var cgpointForSkyHigh = NSEvent.mouseLocation
|
||||||
|
cgpointForSkyHigh.x -= 20
|
||||||
|
cgpointForSkyHigh.y -= 5
|
||||||
|
skyHigh.move(to: cgpointForSkyHigh)
|
||||||
|
#endif
|
||||||
|
|
||||||
guard settings.settings.checkFullscreen else {
|
guard settings.settings.checkFullscreen else {
|
||||||
handleDockValue(dockIsAt: currentDockSide, location: location)
|
handleDockValue(dockIsAt: currentDockSide, location: location)
|
||||||
@@ -108,24 +130,6 @@ class MouseTracker {
|
|||||||
self.monitor = NSEvent.addGlobalMonitorForEvents(matching: .mouseMoved, handler: checkMouse)
|
self.monitor = NSEvent.addGlobalMonitorForEvents(matching: .mouseMoved, handler: checkMouse)
|
||||||
self.running = true
|
self.running = true
|
||||||
print("started tracking")
|
print("started tracking")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
skyHigh.move()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func stop() {
|
func stop() {
|
||||||
@@ -138,11 +142,37 @@ class MouseTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func moveMouse() {
|
func moveMouse() {
|
||||||
let rangeW = screen.width*0.1...screen.width*0.9
|
let prevPoint = NSEvent().mouseLocationCG
|
||||||
|
let rangeW = settings.settings.mouseInsetLeading...settings.settings.mouseInsetTrailing
|
||||||
let posX = CGFloat.random(in: rangeW)
|
let posX = CGFloat.random(in: rangeW)
|
||||||
let rangeH = screen.height*0.1...screen.height*0.9
|
let rangeH = settings.settings.mouseInsetBottom...settings.settings.mouseInsetTop
|
||||||
let posY = CGFloat.random(in: rangeH)
|
let posY = CGFloat.random(in: rangeH)
|
||||||
CGDisplayMoveCursorToPoint(0, CGPoint(x: posX, y: posY))
|
|
||||||
|
timer?.invalidate()
|
||||||
|
loopIteration = 0
|
||||||
|
skyHigh.move(to: prevPoint.invertedForScreen)
|
||||||
|
skyHigh.show()
|
||||||
|
timer = Timer(timeInterval: 0.005, repeats: true) { [weak self] _ in
|
||||||
|
guard let self = self else { return }
|
||||||
|
guard loopIteration < 500 else {
|
||||||
|
skyHigh.hide()
|
||||||
|
settings.settings.mouseMoves += 1
|
||||||
|
refreshMenus()
|
||||||
|
timer?.invalidate()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let newPosX = (prevPoint.x > posX ? prevPoint.x-loopIteration : prevPoint.x+loopIteration)
|
||||||
|
let newPosY = (prevPoint.y > posY ? prevPoint.y-loopIteration : prevPoint.y+loopIteration)
|
||||||
|
let cgpoint = CGPoint(x: newPosX, y: newPosY)
|
||||||
|
CGWarpMouseCursorPosition(cgpoint)
|
||||||
|
var cgpointForSkyHigh = cgpoint
|
||||||
|
cgpointForSkyHigh.x -= 20
|
||||||
|
cgpointForSkyHigh.y += 5
|
||||||
|
skyHigh.move(to: cgpointForSkyHigh.invertedForScreen)
|
||||||
|
|
||||||
|
self.loopIteration += 1
|
||||||
|
}
|
||||||
|
RunLoop.main.add(timer!, forMode: .common)
|
||||||
}
|
}
|
||||||
|
|
||||||
func moveDock(_ toSide: DockSide) {
|
func moveDock(_ toSide: DockSide) {
|
||||||
@@ -173,7 +203,6 @@ class MouseTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getDockSize() {
|
func getDockSize() {
|
||||||
guard let screen = NSScreen.main?.frame else { fatalError() }
|
|
||||||
guard let screenVisible = NSScreen.main?.visibleFrame else { fatalError() }
|
guard let screenVisible = NSScreen.main?.visibleFrame else { fatalError() }
|
||||||
self.dockHeight = screen.height - screenVisible.height
|
self.dockHeight = screen.height - screenVisible.height
|
||||||
}
|
}
|
||||||
|
|||||||
23
DockPhobia/Resources/Assets.xcassets/pinch.imageset/Contents.json
vendored
Normal file
23
DockPhobia/Resources/Assets.xcassets/pinch.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "pinch.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "pinch.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "pinch.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DockPhobia/Resources/Assets.xcassets/pinch.imageset/pinch.png
vendored
Normal file
BIN
DockPhobia/Resources/Assets.xcassets/pinch.imageset/pinch.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.8 KiB |
@@ -12,41 +12,43 @@ class SkyHigh {
|
|||||||
private var window: NSWindow
|
private var window: NSWindow
|
||||||
private var x = 1
|
private var x = 1
|
||||||
private var timer: Timer?
|
private var timer: Timer?
|
||||||
|
var settings: DPSettingsModel
|
||||||
|
|
||||||
init() {
|
init(settings: DPSettingsModel) {
|
||||||
guard let screen = NSScreen.main?.frame else { fatalError() }
|
self.settings = settings
|
||||||
|
|
||||||
self.window = NSWindow(
|
self.window = NSWindow(
|
||||||
contentRect: CGRect(
|
contentRect: CGRect(
|
||||||
x: screen.width*0.05,
|
x: NSScreen.mainFrameWidth/2,
|
||||||
y: screen.height*0.1,
|
y: NSScreen.mainFrameHeight/2,
|
||||||
width: screen.width*0.9,
|
width: 100,
|
||||||
height: screen.height*0.8
|
height: 100
|
||||||
),
|
),
|
||||||
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.backgroundColor = .init(srgbRed: 1, green: 1, blue: 1, alpha: 0)
|
||||||
|
window.contentView = NSImageView(image: NSImage(named: "pinch")!)
|
||||||
window.isOpaque = false
|
window.isOpaque = false
|
||||||
window.level = NSWindow.Level.statusBar + 1
|
window.level = NSWindow.Level.statusBar + 1
|
||||||
window.ignoresMouseEvents = true
|
window.ignoresMouseEvents = true
|
||||||
window.hasShadow = true
|
window.hasShadow = true
|
||||||
window.makeKeyAndOrderFront(nil)
|
window.collectionBehavior = NSWindow.CollectionBehavior.canJoinAllSpaces.union(.stationary)
|
||||||
window.setFrameOrigin(NSPoint(x: screen.width*0.05, y: screen.height*0.1))
|
#if DEBUG
|
||||||
|
show()
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func move() {
|
func move(to: CGPoint) {
|
||||||
x = 1
|
self.window.setFrameOrigin(to)
|
||||||
timer?.invalidate()
|
}
|
||||||
timer = Timer(timeInterval: 0.01, repeats: true) { [weak self] _ in
|
|
||||||
guard let self = self else { return }
|
func show() {
|
||||||
guard x < 1001 else {
|
window.orderFront(nil)
|
||||||
timer?.invalidate()
|
}
|
||||||
return
|
|
||||||
}
|
func hide() {
|
||||||
self.window.setFrameOrigin(NSPoint(x: 1000-self.x, y: 1000-self.x))
|
window.orderOut(nil)
|
||||||
self.x += 1
|
|
||||||
}
|
|
||||||
RunLoop.current.add(timer!, forMode: .common)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
DockPhobia/Views/Preferences.swift
Normal file
8
DockPhobia/Views/Preferences.swift
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Preferences.swift
|
||||||
|
// DockPhobia
|
||||||
|
//
|
||||||
|
// Created by neon443 on 29/05/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
18
README.md
18
README.md
@@ -1,9 +1,14 @@
|
|||||||
# DockPhobia
|
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<br/>
|
<br/>
|
||||||
<p>
|
<p>
|
||||||
<img src="https://github.com/neon443/DockPhobia/blob/main/DockPhobia/Resources/Assets.xcassets/AppIcon.appiconset/DockPhobiaAppIcon.png?raw=true" title="dockphobia" alt="dockphobia icon" width="200" />
|
<img src="https://github.com/neon443/DockPhobia/blob/main/DockPhobia/Resources/Assets.xcassets/AppIcon.appiconset/DockPhobiaAppIcon.png?raw=true" title="dockphobia" alt="dockphobia icon" width="100" />
|
||||||
|
</p>
|
||||||
|
<h3>DockPhobia</h3>
|
||||||
|
<p>
|
||||||
|
<a href="https://github.com/neon443/DockPhobia/releases/latest/download/DockPhobia.dmg">
|
||||||
|
download
|
||||||
|
<img alt="GitHub Release" src="https://img.shields.io/github/v/release/neon443/DockPhobia">
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
make your Dock scared of the mouse
|
make your Dock scared of the mouse
|
||||||
@@ -12,14 +17,11 @@
|
|||||||
made by neon443
|
made by neon443
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
|
||||||
<a href="https://github.com/neon443/DockPhobia/releases/latest/download/DockPhobia.dmg">
|
|
||||||
download
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
<br/>
|
<br/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
Have you ever wanted to use your Dock?
|
Have you ever wanted to use your Dock?
|
||||||
well now you cant
|
well now you cant
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user