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

v3 POC #114

Merged
merged 98 commits into from
Mar 10, 2020
Merged
Changes from 1 commit
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
0f807ee
refactor: complete rework of the internals
Jan 8, 2020
df98ffc
fix: ignore trigger shortcuts if mission control is active
Jan 10, 2020
ddc944d
fix: don't trigger ui refreshes if the app is not active
Jan 10, 2020
7c52e75
fix: prevent visual flickering (closes #115)
Jan 10, 2020
a9e90d1
fix: observer leak would throw and crash the app sometimes
Jan 10, 2020
d799d8a
fix: quitting multiple apps would refresh the ui multiple times
Jan 10, 2020
a552dec
fix: quitting apps was not properly removing apps from the list
Jan 10, 2020
8eeee83
refactor: cleaner code
Jan 10, 2020
76a1fc7
fix: compare correctly since pid can go away when an app dies
Jan 10, 2020
35b48b9
fix: dock being shown was blocking alt-tab
Jan 13, 2020
faa707e
fix: better focus/order for preferences (closes #80)
Jan 14, 2020
1ed9457
fix: handle on-all-spaces windows better
Jan 14, 2020
5428ca4
refactor: factorize and document
Jan 14, 2020
d8638f2
fix: initial discovery when single space was glitching the os
Jan 14, 2020
2a82c7d
fix: a title change often means the content has change
Jan 14, 2020
5f757cb
fix: don't show ui on fast trigger
Jan 14, 2020
b90130c
fix: open alt-tab during space transitions (closes #92)
Jan 14, 2020
5218d61
fix: don't show floating windows + efficiencies
Jan 15, 2020
ede0a27
fix: avoid rendering if app is not used
Jan 15, 2020
5994652
fix: bring back the window delay that regressed with v2
Jan 15, 2020
b1bd0b7
fix: layout is now correct; also removed layout preferences for now
Jan 16, 2020
7f8f5db
refactor: minor syntax change
Jan 16, 2020
2e4006f
fix: add rough downscaling when there are many windows (closes #69)
Jan 16, 2020
0b8b237
fix: remove debug colors
Jan 16, 2020
1a35e30
fix: using floor() everywhere to avoid blurry rendering
Jan 16, 2020
0133974
fix: layout was incorrect resulting in thumbnails clipping
Jan 20, 2020
3067f3c
feat: slightly increase contrast (mitigates #82)
Jan 20, 2020
c4dfb4a
ci: update homebrew cask for new releases (closes #75)
Jan 20, 2020
3ac921d
fix: some apps should retry observing until it works
Jan 20, 2020
d537bf1
fix: app launched while in fullscreen shows first window
Jan 21, 2020
9cd719e
fix: compiler warnings
Jan 22, 2020
8687e06
fix: better float rounding = sharper cell contents
Jan 23, 2020
8f67e5b
fix: only test permissions on the correct os versions
Jan 24, 2020
f5f038a
feat: debug build has code-signing to preserve permissions
Jan 27, 2020
eeab5f6
fix: more robust screen-recording permission check
Jan 27, 2020
be66a01
ci: display env vars at the beginning of a build
Jan 27, 2020
ad2cfc0
ci: remove travis warning by updating keys
Jan 27, 2020
941e6e3
ci: sign releases with apple dev certificate (closes #13)
Jan 27, 2020
14f0265
fix: don't upscale thumbnails of small windows
Jan 29, 2020
5b33c9b
feat: better packing; tall thumbnails are 1/2 the width of wide ones
Jan 29, 2020
97ed973
ci: more packed layout by default
Jan 29, 2020
1310f8a
feat: add back the preferences for the new layout algo
Jan 29, 2020
4c03fea
feat: divide preferences by topic (closes #130)
Feb 4, 2020
d15bcf2
refactor: factorize code in extension
Feb 5, 2020
45568fe
fix: added releases link and aligned layout left on tab 3
Feb 5, 2020
2dd5a39
feat: nicer layout for about preferences
Feb 5, 2020
8817edd
refactor: organize the ui code hierarchically
Feb 5, 2020
8a9264e
refactor: remove unnecessary protocol
Feb 5, 2020
a5b6db9
feat: add in-app feedback form (closes #145)
Feb 5, 2020
c48ac33
fix: regression on collectionviewitem titles (not showing)
Feb 6, 2020
50e77f3
feat: quit button is clearer with explicit mention of the name
Feb 6, 2020
d62e29e
feat: separating the quit button as it is a special case
Feb 6, 2020
f8acf8d
feat: more appealing presentation + minor refac
Feb 6, 2020
1f3f885
feat: add feedback button on about window
Feb 6, 2020
ec601ca
feat: support macos "sudden termination"
Feb 6, 2020
d973a96
feat: add debug profile to feedback message
Feb 6, 2020
1085be2
feat: cleaner layout and explanation text
Feb 6, 2020
bbaee01
feat: replace default copyright with correct licence
Feb 7, 2020
2dfdce5
fix: keyboard shortcuts didn't work without a menu
Feb 7, 2020
4abb01a
fix: better textareas
Feb 7, 2020
9393bc2
feat: add licence to about page
Feb 7, 2020
dc8dcf8
feat: localization (closes #134)
Feb 7, 2020
5d36e04
feat: german and spanish localization
Feb 9, 2020
e4a1523
fix: some apps have messy launch behavior
Feb 9, 2020
eed0353
feat: drag-and-drop files on the ui (closes #74)
Feb 10, 2020
521fdd8
feat: adding cocoapods and letsmove/sparkle
Feb 11, 2020
d3268d0
feat: integrate sparkle for auto-updates (closes #131)
Feb 11, 2020
1b34ae6
feat: migrate to standard os-backed preferences (closes #161)
Feb 12, 2020
a821156
feat: make system calls more parallel (closes #160)
Feb 12, 2020
7b16809
refactor: remove non-resources
Feb 12, 2020
627f3f7
fix: layout regression introduced by eed0353
Feb 13, 2020
fd3eab7
ci: more logs from altool to follow progress
Feb 13, 2020
40e7d12
ci: big refac to finally rationalize the xcode mess
Feb 13, 2020
7cdcd68
fix: notarization issues
Feb 14, 2020
dd8fee3
ci: schemes should be shared and versioned
Feb 14, 2020
038223b
fix: letsmove was not active on release builds
Feb 14, 2020
19260ff
ci: only 1 build, not 1 for each env var
Feb 14, 2020
fe6c865
ci: adding back missing codesign cert
Feb 14, 2020
5bf61cf
ci: added missing pod install
Feb 14, 2020
5dd4501
refactor: less unnecessary logs
Feb 14, 2020
54605f2
fix: also codesign debug builds
Feb 14, 2020
db73462
fix: getting sparkle ready for release
Feb 14, 2020
fd226a3
feat: improved translations
Feb 14, 2020
4274475
fix: feedback token injected during ci
Feb 14, 2020
e282de9
refactor: move resources to top level
Feb 17, 2020
ccbd404
docs: add a guide to navigate the project for newcomers
Feb 21, 2020
943b0ec
refactor: remove unused protocol
lwouis Feb 24, 2020
fe3077c
refactor: correctly append to build settings from pods
lwouis Feb 24, 2020
655bd5c
fix: auto-update preferences sync with os from launch
lwouis Feb 26, 2020
9ed8986
fix: cpu and memory leaks (see discussion in #117)
lwouis Mar 5, 2020
3f5d9f5
refactor: remove debug logs
lwouis Mar 5, 2020
e20db1f
fix: list temporary AXDialog windows like activity monitor
lwouis Mar 6, 2020
7d5a5a8
feat: add an app icon and menubar icon (closes #38)
lwouis Mar 9, 2020
28bae7a
fix: smaller payload for the icons
lwouis Mar 9, 2020
cc35aa6
feat: add preference to start at login (closes #159)
lwouis Mar 10, 2020
49a6d70
fix: ignore build folder
lwouis Mar 10, 2020
2ebe0be
fix: sharper images on non-retina displays
lwouis Mar 10, 2020
ed27d2f
fix: remove unnecessary/wrong layout code
lwouis Mar 10, 2020
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
Prev Previous commit
Next Next commit
fix: some apps have messy launch behavior
See discussion: #117 (comment)
louis.pontoise committed Feb 9, 2020

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit e4a1523aa1bedf13d9a2ac2fe4508d786d19b7ba
12 changes: 7 additions & 5 deletions alt-tab-macos/api-wrappers/AXUIElement.swift
Original file line number Diff line number Diff line change
@@ -49,13 +49,15 @@ extension AXUIElement {
return attribute(kAXSubroleAttribute, String.self)
}

func subscribeWithRetry(_ axObserver: AXObserver, _ notification: String, _ pointer: UnsafeMutableRawPointer?) {
func subscribeWithRetry(_ axObserver: AXObserver, _ notification: String, _ pointer: UnsafeMutableRawPointer?, _ callback: (() -> Void)? = nil, _ previousResult: AXError? = nil) {
let result = AXObserverAddNotification(axObserver, self, notification as CFString, pointer)
if result != .success && result != .notificationUnsupported && result != .notificationAlreadyRegistered {
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(10), execute: {
self.subscribeWithRetry(axObserver, notification, pointer)
})
if result == .success || result == .notificationUnsupported || result == .notificationAlreadyRegistered {
callback?()
return
}
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(10), execute: {
self.subscribeWithRetry(axObserver, notification, pointer, callback, result)
})
}

private func attribute<T>(_ key: String, _ type: T.Type) -> T? {
18 changes: 10 additions & 8 deletions alt-tab-macos/logic/Application.swift
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ class Application: NSObject {
var runningApplication: NSRunningApplication
var axUiElement: AXUIElement?
var axObserver: AXObserver?
var isReallyFinishedLaunching = false

init(_ runningApplication: NSRunningApplication) {
self.runningApplication = runningApplication
@@ -22,13 +23,7 @@ class Application: NSObject {
private func addAndObserveWindows() {
axUiElement = AXUIElementCreateApplication(runningApplication.processIdentifier)
AXObserverCreate(runningApplication.processIdentifier, axObserverCallback, &axObserver)
observeAllWindows()
}

private func observeAllWindows() {
let windows = getActualWindows()
debugPrint("Adding app: " + (runningApplication.bundleIdentifier ?? "nil"), windows.map { $0.title() })
addWindows(windows)
debugPrint("Adding app: " + (runningApplication.bundleIdentifier ?? "nil"))
observeEvents()
}

@@ -65,7 +60,14 @@ class Application: NSObject {
kAXApplicationHiddenNotification,
kAXApplicationShownNotification,
] {
axUiElement!.subscribeWithRetry(axObserver, notification, selfPointer)
axUiElement!.subscribeWithRetry(axObserver, notification, selfPointer, {
// some apps have `isFinishedLaunching == true` but are actually not finished, and will return .cannotComplete
// we consider them ready when the first subscription succeeds, and list their windows again at that point
if !self.isReallyFinishedLaunching {
self.isReallyFinishedLaunching = true
self.observeNewWindows()
}
})
}
CFRunLoopAddSource(CFRunLoopGetCurrent(), AXObserverGetRunLoopSource(axObserver), .defaultMode)
}