Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@ brew install --cask cardinal-search

You can also grab the latest packaged builds from [GitHub Releases](https://github.com/cardisoft/cardinal/releases/).

### macOS integration

Cardinal registers the `cardinal://` URL scheme on macOS. The supported deep link is:

```text
cardinal://search?scope=/path/to/folder&q=keyword
```

- `scope` is optional and opens Cardinal's folder scope with that directory.
- `q` is optional and fills the main search query.
- At least one of `scope` or `q` must be present.

Cardinal also ships a Finder Quick Action workflow at:

```text
Cardinal.app/Contents/Resources/share/batch/macOS service menus/Cardinal, search in folder.workflow
```

Double-click the workflow to install it into `~/Library/Services`. After installation, Finder can show `Search in Cardinal` in Quick Actions or Services for selected files and folders.

### i18n support

Need a different language? Click the ⚙️ button in the status bar to switch instantly.
Expand Down Expand Up @@ -87,3 +107,11 @@ npm run tauri dev -- --release --features dev
cd cardinal
npm run tauri build
```

To create a macOS DMG that exposes the Finder Quick Action installer in the DMG
root, run:

```bash
cd cardinal
npm run package:macos-dmg
```
12 changes: 10 additions & 2 deletions cardinal/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion cardinal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"package:macos-dmg": "bash scripts/package-macos-dmg.sh",
"preview": "vite preview",
"tauri": "tauri",
"test": "vitest --watch=false",
Expand All @@ -16,7 +17,8 @@
},
"dependencies": {
"@crabnebula/tauri-plugin-drag": "^2.1.0",
"@tauri-apps/api": "^2",
"@tauri-apps/api": "2.10.1",
"@tauri-apps/plugin-deep-link": "2.4.8",
"@tauri-apps/plugin-global-shortcut": "^2.3.1",
"@tauri-apps/plugin-opener": "^2",
"@tauri-apps/plugin-window-state": "^2.4.1",
Expand Down
58 changes: 58 additions & 0 deletions cardinal/scripts/package-macos-dmg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
set -euo pipefail

APP_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SRC_TAURI="$APP_ROOT/src-tauri"
TARGET_DIR="$SRC_TAURI/target/release"
APP_BUNDLE="$TARGET_DIR/bundle/macos/Cardinal.app"
SERVICE_MENUS="$APP_BUNDLE/Contents/Resources/share/batch/macOS service menus"
VERSION="$(node -e 'const fs = require("fs"); console.log(JSON.parse(fs.readFileSync("src-tauri/tauri.conf.json", "utf8")).version)')"
ARCH="$(uname -m)"

if [[ "$ARCH" == "arm64" ]]; then
ARCH="aarch64"
fi

DMG_PATH="$TARGET_DIR/Cardinal_${VERSION}_${ARCH}.dmg"
STAGE_DIR="$(mktemp -d "${TMPDIR:-/tmp}/cardinal-dmg-stage.XXXXXX")"

cleanup() {
rm -rf "$STAGE_DIR"
}
trap cleanup EXIT

cd "$APP_ROOT"
npm run tauri build -- --bundles app

if [[ ! -d "$APP_BUNDLE" ]]; then
echo "Missing app bundle: $APP_BUNDLE" >&2
exit 1
fi

if [[ ! -d "$SERVICE_MENUS" ]]; then
echo "Missing macOS service menus: $SERVICE_MENUS" >&2
exit 1
fi

ditto "$APP_BUNDLE" "$STAGE_DIR/Cardinal.app"
ln -s /Applications "$STAGE_DIR/Applications"
ditto "$SERVICE_MENUS" "$STAGE_DIR/macOS service menus"

cat > "$STAGE_DIR/README - Finder Quick Action.txt" <<'EOF'
Install Cardinal first by dragging Cardinal.app to Applications.

To install the Finder Quick Action, open the "macOS service menus" folder and
double-click "Cardinal, search in folder.workflow".

After installation, Finder shows "Search in Cardinal" under Quick Actions or
Services for selected files and folders.
EOF

hdiutil create \
-volname "Cardinal ${VERSION}" \
-srcfolder "$STAGE_DIR" \
-ov \
-format UDZO \
"$DMG_PATH"

echo "Created $DMG_PATH"
103 changes: 103 additions & 0 deletions cardinal/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cardinal/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ tauri-build = { version = "2", features = [] }

[dependencies]
tauri = { version = "2", features = ["tray-icon"] }
tauri-plugin-deep-link = "2"
tauri-plugin-opener = "2"
tauri-plugin-global-shortcut = "2"
tauri-plugin-drag = "2"
Expand Down
1 change: 1 addition & 0 deletions cardinal/src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"core:window:allow-set-focus",
"opener:default",
"macos-permissions:default",
"deep-link:default",
"drag:default",
"global-shortcut:allow-is-registered",
"global-shortcut:allow-register",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSServices</key>
<array>
<dict>
<key>NSBackgroundColorName</key>
<string>background</string>
<key>NSIconName</key>
<string>NSTouchBarSearchTemplate</string>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>Search in Cardinal</string>
</dict>
<key>NSMessage</key>
<string>runWorkflowAsService</string>
<key>NSRequiredContext</key>
<dict>
<key>NSApplicationIdentifier</key>
<string>com.apple.finder</string>
</dict>
<key>NSSendFileTypes</key>
<array>
<string>public.item</string>
</array>
</dict>
</array>
</dict>
</plist>
Loading
Loading