Compare commits

...

2 Commits

5 changed files with 67 additions and 5 deletions
+2 -1
View File
@@ -2,6 +2,7 @@
APP := .build/Conjure.app APP := .build/Conjure.app
INSTALL_DIR ?= /Applications INSTALL_DIR ?= /Applications
CODE_SIGN_IDENTITY ?= -
build: build:
swift build -c release swift build -c release
@@ -11,7 +12,7 @@ build:
cp -R .build/release/Conjure_ConjureKit.bundle $(APP)/Contents/Resources/ cp -R .build/release/Conjure_ConjureKit.bundle $(APP)/Contents/Resources/
swift Scripts/icon.swift .build/Conjure.iconset swift Scripts/icon.swift .build/Conjure.iconset
iconutil -c icns .build/Conjure.iconset -o $(APP)/Contents/Resources/Conjure.icns iconutil -c icns .build/Conjure.iconset -o $(APP)/Contents/Resources/Conjure.icns
codesign --force --sign - $(APP) codesign --force --sign "$(CODE_SIGN_IDENTITY)" $(APP)
run: build run: build
swift Scripts/run.swift "$(APP)" swift Scripts/run.swift "$(APP)"
+13 -2
View File
@@ -19,7 +19,16 @@ For a user-only installation:
make install INSTALL_DIR="$HOME/Applications" make install INSTALL_DIR="$HOME/Applications"
``` ```
Quit the installed copy before reinstalling. Installation does not request administrator privileges. Builds are locally ad-hoc signed, not notarized for distribution. Quit the installed copy before reinstalling. Installation does not request administrator privileges. Builds are ad-hoc signed by default and are not notarized for distribution. Ad-hoc signing ties Accessibility permission to a build's code hash: rebuilding and reinstalling can invalidate an existing grant even while Conjure remains enabled in System Settings.
To preserve permission across rebuilds, use the same code-signing certificate and app location every time:
```sh
security find-identity -v -p codesigning
make install CODE_SIGN_IDENTITY="<certificate SHA-1 from the list>"
```
Pass the same `CODE_SIGN_IDENTITY` to `make build` and `make run` too. If no identity is available, create a local certificate in **Keychain Access → Certificate Assistant → Create a Certificate…**, choosing **Self Signed Root** and **Code Signing**, or use an Apple-issued development certificate. Keep that certificate and its private key; recreating it changes the signing identity. After switching from ad-hoc signing, re-add Conjure to Accessibility once.
To work on the project, open `Package.swift` in Xcode. Run the bundled app for its application identity and metadata; `make run` restarts the development bundle so rebuilt code takes effect. To work on the project, open `Package.swift` in Xcode. Run the bundled app for its application identity and metadata; `make run` restarts the development bundle so rebuilt code takes effect.
@@ -95,7 +104,9 @@ Rates are shared across queries and refreshed on the next currency query after t
Search for **Conjure Emoji**, identified by its centered 🤔 icon, and open it. Browse the grid or search by name, keyword, `:shortcode:`, or emoji. Use the category menu to filter results or show **Recently Used**. Your last 30 selections are saved locally. Favorites appear first, followed by recent selections when browsing All Emoji. Search for **Conjure Emoji**, identified by its centered 🤔 icon, and open it. Browse the grid or search by name, keyword, `:shortcode:`, or emoji. Use the category menu to filter results or show **Recently Used**. Your last 30 selections are saved locally. Favorites appear first, followed by recent selections when browsing All Emoji.
Use the arrow keys or Control-H/J/K/L to navigate left/down/up/right. Return, clicking an emoji, or **Copy and Paste** copies it, dismisses Conjure, and tries to paste into the app that was focused when the launcher opened. Automatic pasting requires **System Settings → Privacy & Security → Accessibility → Conjure**; macOS prompts if permission is missing. After granting it, select an emoji again. If permission is denied, the previous app is unavailable, or focus cannot be restored promptly, the emoji stays copied for manual Command-V. Escape or the Back chevron returns to the launcher and restores your search. Use the arrow keys or Control-H/J/K/L to navigate left/down/up/right; the grid scrolls to keep the selected emoji visible. Return, clicking an emoji, or **Copy and Paste** copies it, dismisses Conjure, and tries to paste into the app that was focused when the launcher opened. Automatic pasting requires **System Settings → Privacy & Security → Accessibility → Conjure**; macOS prompts if permission is missing. After granting it, select an emoji again. If permission is denied, the previous app is unavailable, or focus cannot be restored promptly, the emoji stays copied for manual Command-V. Escape or the Back chevron returns to the launcher and restores your search.
If macOS keeps prompting despite an enabled Accessibility entry, quit Conjure, remove its stale entry with the minus button, add the exact app you launch (normally `/Applications/Conjure.app`), enable it, then reopen Conjure and retry. Avoid switching between installed and `.build` copies. For permission that survives rebuilds, configure certificate signing as described above. **Copy Emoji** followed by manual Command-V works without this permission.
Open **Actions** with Command-K for **Copy and Paste** (default), **Copy Emoji** (copy only, no Accessibility permission needed), **Favorite**, or **Remove Favorite**. Favorites are saved locally and grouped ahead of other emoji, with a small extra spacing break when browsing without a search. There are no star badges. Open **Actions** with Command-K for **Copy and Paste** (default), **Copy Emoji** (copy only, no Accessibility permission needed), **Favorite**, or **Remove Favorite**. Favorites are saved locally and grouped ahead of other emoji, with a small extra spacing break when browsing without a search. There are no star badges.
+1 -1
View File
@@ -147,7 +147,7 @@ final class EmojiPickerController: NSViewController, NSCollectionViewDataSource,
selected = min(max(selected + offset, 0), results.count - 1) selected = min(max(selected + offset, 0), results.count - 1)
(collection.item(at: indexPath(for: old)) as? EmojiItem)?.highlight(false) (collection.item(at: indexPath(for: old)) as? EmojiItem)?.highlight(false)
updateSelection() updateSelection()
collection.scrollToItems(at: [indexPath(for: selected)], scrollPosition: .nearestVerticalEdge) collection.scrollToItems(at: [indexPath(for: selected)], scrollPosition: .nearestHorizontalEdge)
} }
private var columns: Int { max(1, Int((collection.bounds.width - 32 + 6) / 70)) } private var columns: Int { max(1, Int((collection.bounds.width - 32 + 6) / 70)) }
+4 -1
View File
@@ -1,3 +1,6 @@
- [x] tighten Command presentation lifetime contracts: guarantee complete Command-owned Actions teardown and distinguish one-level Back from full dismissal or destination replacement. Fixed in the existing controllers without extracting another presentation module. Covered nested Escape, query restoration, replacement with Actions open, and copy/paste dismissal. - [x] bugfix: the emoji picker currently doesn't scroll with the selection (arrows or ctrl+hjkl), only with mouse scroll.
- the window should scroll with the current selection
- [ ] make escape close the window that was opened, be it the application launcher, the emoji picker, or something else.
- clicking the "back" chevron should still take you back to the application launcher view though (as it does today).
- [ ] add a notes app inspired by raycast notes - [ ] add a notes app inspired by raycast notes
- [ ] improve on the conjure translation command - [ ] improve on the conjure translation command
@@ -51,6 +51,53 @@ import Testing
#expect(defaults.stringArray(forKey: "recentEmoji") == ["👩‍💻", matches[1].value]) #expect(defaults.stringArray(forKey: "recentEmoji") == ["👩‍💻", matches[1].value])
} }
@Test(arguments: [false, true], [false, true])
@MainActor func emojiKeyboardNavigationKeepsSelectionVisible(controlKeys: Bool, favorites: Bool) throws {
_ = NSApplication.shared
let suite = "ConjureEmojiScroll.\(UUID().uuidString)"
let defaults = UserDefaults(suiteName: suite)!
let pasteboard = NSPasteboard.withUniqueName()
defer { defaults.removePersistentDomain(forName: suite); pasteboard.releaseGlobally() }
let favored = favorites ? Array(EmojiCatalog.all.suffix(3)) : []
defaults.set(favored.map(\.value), forKey: "favoriteEmoji")
let ordered = favored + EmojiCatalog.all.filter { emoji in !favored.contains { $0.value == emoji.value } }
let picker = EmojiPickerController(defaults: defaults, pasteboard: pasteboard)
let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 750, height: 400),
styleMask: [.borderless], backing: .buffered, defer: false)
window.contentView = picker.view
picker.view.layoutSubtreeIfNeeded()
let scroll = try #require(picker.view.subviews.compactMap { $0 as? NSScrollView }.first)
let grid = try #require(scroll.documentView as? NSCollectionView)
func expectVisible() throws {
picker.copySelection()
let index = try #require(ordered.firstIndex { $0.value == pasteboard.string(forType: .string) })
let path = favorites && index >= favored.count
? IndexPath(item: index - favored.count, section: 1) : IndexPath(item: index, section: 0)
let frame = try #require(grid.collectionViewLayout?.layoutAttributesForItem(at: path)?.frame)
try #require(scroll.documentVisibleRect.contains(frame))
}
for down in [true, false] {
for _ in 0..<12 {
if controlKeys {
#expect(picker.handleControlKey(down ? "j" : "k"))
} else {
#expect(picker.handle(down ? #selector(NSResponder.moveDown(_:)) : #selector(NSResponder.moveUp(_:))))
}
try expectVisible()
}
}
for right in [true, false] {
for _ in 0..<80 {
if controlKeys {
#expect(picker.handleControlKey(right ? "l" : "h"))
} else {
#expect(picker.handle(right ? #selector(NSResponder.moveRight(_:)) : #selector(NSResponder.moveLeft(_:))))
}
try expectVisible()
}
}
}
@Test @MainActor func emojiActionsDefaultToPasteAndKeepCopyOnlyAvailable() throws { @Test @MainActor func emojiActionsDefaultToPasteAndKeepCopyOnlyAvailable() throws {
_ = NSApplication.shared _ = NSApplication.shared
let suite = "ConjureEmojiActions.\(UUID().uuidString)" let suite = "ConjureEmojiActions.\(UUID().uuidString)"