|
1 | 1 | # OpenInCode |
2 | 2 |
|
3 | | -Finder toolbar app that opens the current Finder folder—or the folder containing the selected file—in Visual Studio Code. |
4 | | - |
5 | | -OpenInCode prefers stable Visual Studio Code and falls back to Visual Studio Code Insiders when stable is not installed. |
| 3 | +Open the folder you are viewing in Finder—or the folder containing a selected item—in Visual Studio Code with one toolbar click. |
6 | 4 |
|
7 | 5 | ## Requirements |
8 | 6 |
|
9 | 7 | - macOS 12 or newer |
10 | 8 | - Visual Studio Code or Visual Studio Code Insiders |
11 | | -- Swift 6.2 or newer |
12 | | -- Xcode 26 or newer for the `actool` step that compiles the current Icon Composer asset |
13 | 9 |
|
14 | 10 | ## Install |
15 | 11 |
|
16 | | -Install the latest release from the Homebrew tap: |
| 12 | +Install the latest release with Homebrew: |
17 | 13 |
|
18 | 14 | ```sh |
19 | 15 | brew install --cask sozercan/repo/open-in-code |
20 | 16 | ``` |
21 | 17 |
|
22 | | -Release archives are also available from the [GitHub Releases](https://github.com/sozercan/OpenInCode/releases) page. |
| 18 | +You can also download the app from [GitHub Releases](https://github.com/sozercan/OpenInCode/releases). If you download it directly, move **Open in Code.app** to `/Applications`. |
23 | 19 |
|
24 | | -To build from source: |
| 20 | +## Add Open in Code to Finder |
25 | 21 |
|
26 | | -1. Clone this repository. |
27 | | -2. Run `./scripts/build-app.sh release`. The script uses SwiftPM and creates `.build/app/Open in Code.app`. |
28 | | -3. Copy `Open in Code.app` to `/Applications`. |
29 | | -4. Hold Command and drag the app from `/Applications` to a Finder toolbar. |
30 | | -5. Click the toolbar icon while viewing a folder or selecting a file. |
| 22 | +1. Open `/Applications` in Finder. |
| 23 | +2. Hold Command and drag **Open in Code** to the Finder toolbar. |
| 24 | +3. Release it where you want the toolbar button to appear. |
31 | 25 |
|
32 | | -The first use asks for permission to control Finder. If permission was denied, enable **Open in Code → Finder** here: |
| 26 | +To remove or reposition the button later, hold Command while dragging it. |
33 | 27 |
|
34 | | -- macOS 13 or newer: **System Settings → Privacy & Security → Automation** |
35 | | -- macOS 12: **System Preferences → Security & Privacy → Privacy → Automation** |
| 28 | +## Use |
36 | 29 |
|
37 | | -The local packaging script applies an ad-hoc signature by default so Finder automation entitlements are available during development. Public release artifacts should be signed with a Developer ID Application certificate and notarized before distribution. |
| 30 | +Open a Finder window, optionally select an item, and click **Open in Code** in the toolbar. |
38 | 31 |
|
39 | | -## Development |
| 32 | +- A selected folder opens directly. |
| 33 | +- A selected file or Finder package opens its containing folder. |
| 34 | +- If multiple items are selected, the first item is used. |
| 35 | +- If nothing is selected, the folder shown in the front Finder window opens. |
| 36 | +- Visual Studio Code is preferred; Visual Studio Code Insiders is used when the stable app is not installed. |
40 | 37 |
|
41 | | -Build the SwiftPM executable and run the focused path and editor-selection tests: |
| 38 | +## Allow Finder access |
42 | 39 |
|
43 | | -```sh |
44 | | -swift build |
45 | | -./scripts/test.sh |
46 | | -``` |
| 40 | +On first use, macOS asks whether **Open in Code** may control Finder. Allow access so the app can read the current Finder selection. |
47 | 41 |
|
48 | | -Assemble an unsigned Release app bundle for verification: |
| 42 | +If access was previously denied, enable **Open in Code → Finder** here: |
49 | 43 |
|
50 | | -```sh |
51 | | -OPEN_IN_CODE_SIGNING=unsigned ./scripts/build-app.sh release |
52 | | -``` |
53 | | - |
54 | | -Set `ARCHES="arm64 x86_64"` when a universal app is required. |
55 | | - |
56 | | -## Publishing a release |
57 | | - |
58 | | -Pushing a `v*` tag runs `.github/workflows/release.yml`. The workflow builds a universal app, signs it, creates a GitHub release, and updates `Casks/open-in-code.rb` in [`sozercan/homebrew-repo`](https://github.com/sozercan/homebrew-repo). |
59 | | - |
60 | | -Public releases require all of these Actions secrets: |
| 44 | +- macOS 13 or newer: **System Settings → Privacy & Security → Automation** |
| 45 | +- macOS 12: **System Preferences → Security & Privacy → Privacy → Automation** |
61 | 46 |
|
62 | | -- `HOMEBREW_REPO_SSH_KEY`: the private half of a write-enabled deploy key for `sozercan/homebrew-repo` |
63 | | -- `MACOS_CERTIFICATE`, `MACOS_CERTIFICATE_PWD`, `MACOS_KEYCHAIN_PWD`: a Developer ID Application PKCS#12 and its temporary keychain credentials |
64 | | -- `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, `APPLE_TEAM_ID`: notarization credentials |
| 47 | +## Contributing |
65 | 48 |
|
66 | | -Tag pushes and manual runs with `publish=true` fail unless Developer ID signing and notarization succeed. A manual run with `publish=false` may use ad-hoc signing for validation, but it never creates a GitHub release or updates Homebrew. Prerelease tags create GitHub prereleases but do not replace the stable Homebrew cask. |
| 49 | +See [CONTRIBUTING.md](CONTRIBUTING.md) for source builds, tests, packaging, and release instructions. |
0 commit comments