Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: efficient current Dock item detection and improved window management #254

Merged
merged 44 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a7d50eb
perf: remove the global listener for mouse movements\clicks
ShlomoCode Aug 14, 2024
7a31158
apply hover window delay to switching between apps
ejbills Aug 22, 2024
153cd2e
Merge branch 'main' into pr/254
ejbills Aug 31, 2024
46d0831
fix compile errors
ejbills Aug 31, 2024
87a6905
rename method
ejbills Aug 31, 2024
7cb6d58
remove outdated mouse computations which cause misaligned window
ejbills Aug 31, 2024
a1595c5
fix mouse hovering inaccuracy
ejbills Aug 31, 2024
3d1ab3c
window fade out effect
ejbills Aug 31, 2024
8fd067c
customizable fade out duration
ejbills Aug 31, 2024
8787c58
restore last app under mouse logic
ejbills Aug 31, 2024
9c27ffa
fix full size preview not rendering when app in full screen
ejbills Aug 31, 2024
c530e29
add a buffer zone to not immediately hide when mouse goes over an ina…
ejbills Aug 31, 2024
c0f99f5
reword
ShlomoCode Aug 31, 2024
635e2de
reword
ShlomoCode Aug 31, 2024
b5ce82c
restore mouse location conversions
ejbills Aug 31, 2024
271de4e
properly access defaults object from outside a view
ejbills Aug 31, 2024
31a99a5
remove uselss prints
ejbills Aug 31, 2024
e2795f7
grammar
ejbills Aug 31, 2024
eb19576
refactor
ejbills Sep 1, 2024
7664115
only use timer when duration is > 0
ejbills Sep 1, 2024
0dd5445
fix lint failure
ejbills Sep 1, 2024
1ce8c0b
immediately hide window
ejbills Sep 1, 2024
c96bf59
fix window placement and inaccurate scwindow config
ejbills Sep 1, 2024
5b46215
remove useless code snippets
ejbills Sep 1, 2024
e209056
hide window before displaying and remove previous app logic
ejbills Sep 1, 2024
57d8f40
remove comment
ejbills Sep 2, 2024
956c930
refactor
ejbills Sep 2, 2024
6a0eb24
properly manage hiding window logic
ejbills Sep 2, 2024
bf0f098
remove no longer needed view hiding logic
ejbills Sep 2, 2024
779e5ad
Refine mouse position check for window dismissal
ejbills Sep 2, 2024
4e41dd1
implement timer to catch lingering windows within WindowDismissalCont…
ejbills Sep 2, 2024
d5dc724
reset opacity edge case
ejbills Sep 2, 2024
7905301
add comment for clarity
ejbills Sep 2, 2024
6d053f2
fix invisible window switcher
ejbills Sep 3, 2024
4645128
fix window switcher update inconsistency
ejbills Sep 3, 2024
e91d5da
remove useless notification types
ejbills Sep 3, 2024
d5b92eb
better window state update management
ejbills Sep 3, 2024
7b847f4
improve button reliability
ejbills Sep 3, 2024
b0d22b7
fallback to activating entire application
ejbills Sep 3, 2024
65156e6
fix window raise and matching logic
ejbills Sep 3, 2024
89ddd59
reduce distance to hide lingering window
ejbills Sep 3, 2024
5d49d96
move alpha reset
ejbills Sep 3, 2024
a156947
apply window debounce cancellation logic to window dismissal container
ejbills Sep 3, 2024
fd6f629
smart distance threshold
ejbills Sep 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions DockDoor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
BB3967FD2C291D5A004F1AB6 /* StackedShadow.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3967FC2C291D5A004F1AB6 /* StackedShadow.swift */; };
BB3968002C2A6C44004F1AB6 /* SmoothGradient in Frameworks */ = {isa = PBXBuildFile; productRef = BB3967FF2C2A6C44004F1AB6 /* SmoothGradient */; };
BB3968022C2A6CC2004F1AB6 /* Marquee.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3968012C2A6CC2004F1AB6 /* Marquee.swift */; };
BB3D6EAE2C82E4B400FFE584 /* WindowDismissalContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3D6EAD2C82E4AE00FFE584 /* WindowDismissalContainer.swift */; };
BB3D6EB02C84E58400FFE584 /* NSScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3D6EAF2C84E58000FFE584 /* NSScreen.swift */; };
BB44474F2C507F950047EB92 /* LimitedTaskGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB44474E2C507F920047EB92 /* LimitedTaskGroup.swift */; };
BB4B444B2C372A4E006680DC /* WindowPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4B444A2C372A4C006680DC /* WindowPreview.swift */; };
BB4ED9072C3C75CA00BBDD16 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = BB4ED9062C3C75CA00BBDD16 /* Localizable.xcstrings */; };
Expand All @@ -47,7 +49,6 @@
BBCFAE402C266234002E1516 /* FirstTimeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBCFAE3F2C266234002E1516 /* FirstTimeView.swift */; };
BBE7CC8F2C22421900AB8F4D /* Settings in Frameworks */ = {isa = PBXBuildFile; productRef = BBE7CC8E2C22421900AB8F4D /* Settings */; };
BBE7CC912C22429A00AB8F4D /* settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBE7CC902C22429A00AB8F4D /* settings.swift */; };
BBE7CC942C225D9700AB8F4D /* App Icon.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBE7CC932C225D9700AB8F4D /* App Icon.swift */; };
BBF413922C40618D00AA6733 /* FullSizePreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF413912C40618800AA6733 /* FullSizePreviewView.swift */; };
BBF413942C40978400AA6733 /* WindowPreviewHoverContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF413932C40977F00AA6733 /* WindowPreviewHoverContainer.swift */; };
BBF4139A2C40A64A00AA6733 /* FluidGradient.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF413992C40A64000AA6733 /* FluidGradient.swift */; };
Expand Down Expand Up @@ -82,6 +83,8 @@
BB2CBB082C48128D004502C5 /* SpaceWindowCacheManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpaceWindowCacheManager.swift; sourceTree = "<group>"; };
BB3967FC2C291D5A004F1AB6 /* StackedShadow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StackedShadow.swift; sourceTree = "<group>"; };
BB3968012C2A6CC2004F1AB6 /* Marquee.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Marquee.swift; sourceTree = "<group>"; };
BB3D6EAD2C82E4AE00FFE584 /* WindowDismissalContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowDismissalContainer.swift; sourceTree = "<group>"; };
BB3D6EAF2C84E58000FFE584 /* NSScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSScreen.swift; sourceTree = "<group>"; };
BB44474E2C507F920047EB92 /* LimitedTaskGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LimitedTaskGroup.swift; sourceTree = "<group>"; };
BB4B444A2C372A4C006680DC /* WindowPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowPreview.swift; sourceTree = "<group>"; };
BB4ED9062C3C75CA00BBDD16 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
Expand All @@ -96,7 +99,6 @@
BBA153FB2C12356100119C02 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
BBCFAE3F2C266234002E1516 /* FirstTimeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstTimeView.swift; sourceTree = "<group>"; };
BBE7CC902C22429A00AB8F4D /* settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = settings.swift; sourceTree = "<group>"; };
BBE7CC932C225D9700AB8F4D /* App Icon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "App Icon.swift"; sourceTree = "<group>"; };
BBF413912C40618800AA6733 /* FullSizePreviewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullSizePreviewView.swift; sourceTree = "<group>"; };
BBF413932C40977F00AA6733 /* WindowPreviewHoverContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowPreviewHoverContainer.swift; sourceTree = "<group>"; };
BBF413992C40A64000AA6733 /* FluidGradient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FluidGradient.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -126,6 +128,7 @@
3A105FD42C1BED5B0015EC66 /* Components */ = {
isa = PBXGroup;
children = (
BB3D6EAF2C84E58000FFE584 /* NSScreen.swift */,
BB04405C2C77A878009F1D33 /* Defaults */,
BBF413992C40A64000AA6733 /* FluidGradient.swift */,
3A105FD52C1BED660015EC66 /* BlurView.swift */,
Expand Down Expand Up @@ -213,7 +216,6 @@
BB157B812C0EB29E00997315 /* DockObserver.swift */,
BBF6C6232C1B4B4400BF1D40 /* KeybindHelper.swift */,
BB1CBD5C2C1BCA4F003969BC /* Misc Utils.swift */,
BBE7CC932C225D9700AB8F4D /* App Icon.swift */,
BB7CA33C2C31F1B00012E303 /* WindowManipulationObservers.swift */,
);
path = Utilities;
Expand All @@ -222,6 +224,7 @@
BB4B44492C372A42006680DC /* Hover Window */ = {
isa = PBXGroup;
children = (
BB3D6EAD2C82E4AE00FFE584 /* WindowDismissalContainer.swift */,
BBF413932C40977F00AA6733 /* WindowPreviewHoverContainer.swift */,
BB4B444A2C372A4C006680DC /* WindowPreview.swift */,
BBF413912C40618800AA6733 /* FullSizePreviewView.swift */,
Expand Down Expand Up @@ -369,6 +372,8 @@
files = (
0531F8D22C3CC04600327808 /* AppearanceSettingsView.swift in Sources */,
BB6A4F1C2C1CFCFF00CB4C9E /* PermissionsSettingsView.swift in Sources */,
BB3D6EB02C84E58400FFE584 /* NSScreen.swift in Sources */,
BB3D6EAE2C82E4B400FFE584 /* WindowDismissalContainer.swift in Sources */,
BB3967FD2C291D5A004F1AB6 /* StackedShadow.swift in Sources */,
BBF4139A2C40A64A00AA6733 /* FluidGradient.swift in Sources */,
BB7CA33D2C31F1B00012E303 /* WindowManipulationObservers.swift in Sources */,
Expand All @@ -378,7 +383,6 @@
BB0440622C77AE8D009F1D33 /* GradientColorPaletteSettingsView.swift in Sources */,
BB1CBD5D2C1BCA4F003969BC /* Misc Utils.swift in Sources */,
3A105FD92C1C049E0015EC66 /* dockStyle.swift in Sources */,
BBE7CC942C225D9700AB8F4D /* App Icon.swift in Sources */,
BB2CBB092C481295004502C5 /* SpaceWindowCacheManager.swift in Sources */,
BB3968022C2A6CC2004F1AB6 /* Marquee.swift in Sources */,
BB0440602C77AD2C009F1D33 /* CodableColor.swift in Sources */,
Expand Down
19 changes: 19 additions & 0 deletions DockDoor/Components/NSScreen.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Cocoa

extension NSScreen {
static func screenContainingMouse(_ point: CGPoint) -> NSScreen? {
let screens = NSScreen.screens
let pointInScreenCoordinates = CGPoint(x: point.x, y: NSScreen.screens.first!.frame.maxY - point.y)

return screens.first { screen in
NSPointInRect(pointInScreenCoordinates, screen.frame)
} ?? NSScreen.main
}

func convertPoint(fromGlobal point: CGPoint) -> CGPoint {
let primaryScreen = NSScreen.screens.first!
let baseCoordinate = primaryScreen.frame.maxY
let flippedPoint = CGPoint(x: point.x, y: baseCoordinate - point.y)
return CGPoint(x: flippedPoint.x - frame.minX, y: flippedPoint.y - frame.minY)
}
}
Loading