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
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/.idea/
xcuserdata/
xcshareddata/
WorkspaceSettings.xcsettings
IDEWorkspaceChecks.plist
/node_modules/
/DerivedData/
/Pods/
/build/

.DS_Store

32 changes: 20 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,33 @@ node_js:
- 10
cache: npm
env:
- IS_RELEASE=$(if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then echo true; fi)
install:
- npm ci
global:
- IS_RELEASE=$(if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then echo true; fi)
- XCODE_BUILD_PATH="DerivedData/alt-tab-macos/Build/Products/Release"
- VERSION_FILE="VERSION.txt"
- CHANGELOG_DELTA_FILE="CHANGELOG_DELTA.txt"
- APP_NAME="$(awk -F ' = ' '/PRODUCT_NAME/ { print $2; }' < config/base.xcconfig)"
install: true # disable default install
script:
- env | sort
- npm ci
- npx commitlint-travis
- if [ $IS_RELEASE ]; then ci/determine_version.sh; fi
- if [ $IS_RELEASE ]; then ci/set_version_in_app.sh; fi
- xcodebuild
- if [ $IS_RELEASE ]; then ci/package_release.sh; fi
- if [ $IS_RELEASE ]; then scripts/determine_version_and_changelog.sh; fi
- if [ $IS_RELEASE ]; then scripts/replace_environment_variables_in_app.sh; fi
- pod install
- scripts/import_codesign_certificate_into_keychain.sh
- xcodebuild -workspace alt-tab-macos.xcworkspace -scheme Release
- if [ $IS_RELEASE ]; then scripts/package_and_notarize_release.sh; fi
- if [ $IS_RELEASE ]; then scripts/update_appcast.sh; fi
- if [ $IS_RELEASE ]; then scripts/update_homebrew_cask.sh; fi
- if [ $IS_RELEASE ]; then npx semantic-release; fi
deploy:
provider: releases
api_key:
token:
secure: wcAMT2rbXhhdk6lsc6EG9VZZkSW0BjOwjYSyXzHjKrgiXsQcZAzAsOkuisj8EfeYN9/uhpa8XX7f5KsdkE5reMqVGGWqdmJU4NnmK5Aew0LmBbzFHfffliQecVCzMmGYPmhPcDxAjidYxgCMrMbvQFaElc0WXdIsQNcaNieSkEgZw6TwGsTxgHXABD2e575K3SN/PPcq7Nx5mRZkURI7YLmo2KfsD2OPR4IcEXFpJRFbPcAZIpKaHUIC2VzpayJA93pBe+siwU150p04PzfSs/nTH/nUO9m24SUi6kAIzVN77cExvX+JDnQoVLz0V45L0iJjkKDTVb07rVOsfm6Pcuaaj2ZVXlpujSb7B5LDUIspUn/NnqMLOtzbSTuaGcx2u+zCcC0b17KooznilQ/sFq3YpeNdmjL4VL5fsw1hdpjcP6S9DqZ90TJZqy6xBQP5NubuJukH//BRilhWGfnq5rOFUlqrN8aApJ7gYry0K2rB8rVWWvA9cU+zX351iy0EERICEU6q3rQwq8gFUbdNATPJJgNg7n0PaNXSQTTF9VluZTRVUtMrpA0hWe7dn+Tvrvhrnhmqvccw3Qfw/i3SECIDHHtsjwLqHCx5gkz/xUdf7+t3k6x+r6Veua0Z3jvyVhdHprU47VTSUhM/n87EiKyNRuKa9IpA18eSlZ59exU=
file_glob: true
file:
- build/Release/*.zip
- build/Release/*.tar.gz
skip_cleanup: true
file: "$XCODE_BUILD_PATH/*.zip"
cleanup: false
on:
repo: lwouis/alt-tab-macos
branches:
Expand Down
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Contributing to the project

This project is open-source under the [GPL v3 license](https://github.com/lwouis/alt-tab-macos/blob/master/LICENCE.md). Contributions are welcomed!

In this document you will find some pointers to get started

## Mac development ecosystem

Mac development ecosystem is pretty terrible in general. They keep piling on the tech stacks on top of each other, so you have C APIs, ObjC APIs, Swift APIs, Interface builder, Playgrounds, Swift UI. All these are bridging each other with a bunch of macros, SDKs glue, compiler flags, compatibility mode, XCode legacy build system, etc. So keep that in mind. For alt-tab, we are on Swift 4.2. Note that swift just recently started being stable, but overall any change of version breaks a lot of stuff. Swift itself is the worst governed language project I’ve seen in modern times.

Regarding SDKs, it’s very different from other (better) ecosystems like Java. Here the SDK is bundled with XCode, and XCode is bundled with the OS. This means that from a machine running let’s say macOS 10.10, you have access to only a specific range of XCode versions (you can’t run the latest for instance), and these give you access to a specific range of SDKs (i.e. Swift + objc + c + bridges + compiler + toolchain + etc)

Documentation is abysmal. Very simple things are not documented at all, and good information is hard to find. Compared to other ecosystem I’ve worked on in the past like Android, nodejs, Java, rust, this is really a bad spot. You can truly tell Apple doesn’t care about supporting third-parties. They are in such a good position that people will struggle and just push through to deliver on their ecosystem because it is so valuable, and because they don’t have to care, they don’t. They could pay an intern to update the docs over the summer for instance, just to give you context of the lack of care we are talking about here.

Dependencies were historically never handled by Apple. The community came up with [Cocoapods](https://cocoapods.org/) which is the de-facto dependency manager for Apple ecosystem projects these days, even though Apple is now trying to push their own.

OS APIs are quite limited for the kind of low-level, system-wide app alt-tab is. This means often we just don’t have an API to do something. For instance, there is no API to ask the OS “how many Spaces does the user have?” or “Can you focus the window on Space 2?”. There are however, retro-engineered private APIs which you can call. These are not documented at all, not guaranteed to be there in future macOS releases, and prevent us from releasing alt-tab on the Mac AppStore. We have tried my best to [document](src/api-wrappers/PrivateApis.swift) the ones we are using, as well as ones we investigated in the past.

## This project specifically

To mitigate the issues listed above, we took some measures.

We minimize reliance on XCode, InterfaceBuilder, Playground, and other GUI tools. You can’t cut the dependency completely though as only XCode can build macos apps. Currently the project has these files:

* 1 xib (InterfaceBuilder UI file, describing the menubar items like “Edit” or “Format”)
* `alt-tab-macos.xcodeproj` file describing alt-tab itself. It contains some settings for the app
* `alt-tab-macos.xcworkspace` file describing an xcode workspace containing alt-tab + cocoapods dependencies. You open that file to open the project in XCode or AppCode
* `Alt-tab-macos.entitlements` and Info.plist which are static files describing some app config for XCode
* `PodFile` and `PodFile.lock` describe dependencies on open-source libraries (e.g. [Sparkle](https://github.com/sparkle-project/Sparkle))
* Some `.xcconfig` files in `config/` which contain XCode settings that people typically change using XCode UI, but that I want to be version controlled

We use the command line to build the project, not XCode GUI. See how to build in the [README.md](README.md).

The project directory is organized in the following way:

| Path | Role |
|------|-------|
| `config/` | XCode build settings |
| `docs/` | supporting material to document the project |
| `resources/` | files that are shipped inside the final `.app` (e.g. icons) |
| `scripts/` | bash scripts useful for CI and local workflows |
| `src/` | Swift source code |
| `src/api-wrappers` | Wrapping some unfriendly APIs (usually C-APIs) |
| `src/logic` | Business logic (i.e. "models") |
| `src/ui` | UI code (e.g. sublasses of NSView or NSCollectionView) |

Other folders/files are either tooling or auto-generated (e.g. `Pods/` and `Frameworks/` are generated by `pod install`)
26 changes: 18 additions & 8 deletions alt-tab-macos/Info.plist → Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ATSApplicationFontsPath</key>
<string></string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -20,15 +20,25 @@
<string>#VERSION#</string>
<key>CFBundleVersion</key>
<string>#VERSION#</string>
<key>FeedbackToken</key>
<string>#FEEDBACK_TOKEN#</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
<string>true</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 Pontoise, Louis. All rights reserved.</string>
<string>GPL-3.0 licence</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>LSUIElement</key>
<string>1</string>
<key>ATSApplicationFontsPath</key>
<string></string>
<key>NSSupportsSuddenTermination</key>
<string>true</string>
<key>SUEnableAutomaticChecks</key>
<string>true</string>
<key>SUFeedURL</key>
<string>https://raw.githubusercontent.com/lwouis/alt-tab-macos/master/appcast.xml</string>
<key>SUPublicEDKey</key>
<string>2e9SQOBoaKElchSa/4QDli/nvYkyuDNfynfzBF6vJK4=</string>
<key>CFBundleIconFile</key>
<string>app-icon</string>
</dict>
</plist>
8 changes: 8 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
platform :osx, '10.12'

target 'alt-tab-macos' do
use_frameworks!
pod 'LetsMove', '1.24'
pod 'Sparkle', '1.23.0'
end

20 changes: 20 additions & 0 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
PODS:
- LetsMove (1.24)
- Sparkle (1.23.0)

DEPENDENCIES:
- LetsMove (= 1.24)
- Sparkle (= 1.23.0)

SPEC REPOS:
trunk:
- LetsMove
- Sparkle

SPEC CHECKSUMS:
LetsMove: fefe56bc7bc7fb7d37049e28a14f297961229fc5
Sparkle: 55b1a87ba69d56913375a281546b7c82dec95bb0

PODFILE CHECKSUM: 465451026269525f0f1d2dc7053cf0b789a35421

COCOAPODS: 1.8.4
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ choose **Open** then click **Open** in the prompt that appears.

From macOS 10.12 to 10.15

## Localization

The app is currently available in: English, Français, Deutsch, Español, 日本語

[Contribute your own language easily!](https://poeditor.com/join/project/8AOEZ0eAZE)

## Usage

* Press `⌥ option` + `⇥ tab` to shows the thumbnails.
Expand All @@ -33,9 +39,11 @@ From macOS 10.12 to 10.15
* Change the shortcut key, switch to a Windows theme and more, using the Preferences window.
* If you like scriptable/portable configuration, you can edit `~/Library/Preferences/alt-tab-macos.json`.

## Community
## Contributing

Come discuss with us on the [Discord server](https://discord.gg/mHvmcqT).
* [CONTRIBUTING.md](CONTRIBUTING.md) gives an overview of the project for newcomers who want to contribute.
* Come discuss with us on the [Discord server](https://discord.gg/mHvmcqT).
* [Suggest an enhancement or discuss an issue on github](https://github.com/lwouis/alt-tab-macos/issues).

## Alternatives

Expand All @@ -51,6 +59,17 @@ Before building my own app, I looked around at similar apps. However, none was c
| `⌘ command` + `⇥ tab` | Only shows apps, not windows (note: can press down to see window of selected app) |
| `⌘ command` + `` ` `` | Cycles through tabs and windows, but only of the same app. Only cycling, no direct access |

## Building the project locally

This project has minimal dependency on Xcode-only features (e.g. InterfaceBuilder, Playgrounds). You can build it using 2 commands:

* `pod install` to fetch the dependencies with [CocoaPods](https://cocoapods.org/)
* `xcodebuild -workspace alt-tab-macos.xcworkspace -scheme Release` to build the .app

Note that on debug builds, to avoid having to re-check the `System Preferences > Security & Privacy` permissions on every build, we use a code-signing certificate. You can generate one on your local machine in one step by running `scripts/generate_selfsigned_codesign_certificate.sh`.

If you want to contribute a PR, please run `npm install` once. It will add the pre-commit hook to ensure that your commits follow the convention and will pass the PR.

## Screenshots

### 1 row
Expand Down
Loading