### Install DeckClip with Homebrew Source: https://deckclip.app/download Run these three commands in order to install DeckClip using Homebrew. Ensure you have Homebrew installed first. ```bash brew tap yuzeguitarist/deck ``` ```bash export HOMEBREW_CASK_OPTS="--no-quarantine" ``` ```bash brew install --cask deckclip ``` -------------------------------- ### Orbit Settings Tab UI Implementation Source: https://deckclip.app/changelog Integrates the Orbit settings tab UI, including intro, guide, and installed stages. It also handles Option key interactions, Orbit window visibility, and the installation progress flow. ```swift OrbitSettingsView.swift · OrbitWindow.swift · Deck/Deck/Orbit/ ``` -------------------------------- ### Install Deck via Homebrew Source: https://deckclip.app/changelog Use these commands to tap the repository and install the Deck application cask. ```bash brew tap yuzeguitarist/deck && brew install --cask deckclip ``` -------------------------------- ### Install DeckClip via Homebrew Source: https://deckclip.app/changelog Use these commands to install DeckClip using Homebrew. Future releases will auto-sync from GitHub Releases. ```bash brew tap yuzeguitarist/deck ``` ```bash brew install --cask deckclip ``` -------------------------------- ### Orbit Installer and Resource Loader Source: https://deckclip.app/changelog Implements the installer and resource loader for bundled Orbit assets like icons and zip files. It also handles install detection and improves texture loading fallbacks. ```swift OrbitInstaller.swift · OrbitResources.swift · OrbitIcon.png · OrbitApp.zip · black_hole_texture.png · BlackHoleView.swift ``` -------------------------------- ### Install Global Keyboard Monitor for Copy Events Source: https://deckclip.app/blog/clipboard-monitoring Installs a global event monitor to detect Command+C or Command+X key presses. A short delay is included to allow the source application to write to the pasteboard. This bypasses the regular polling cycle for immediate clipboard checks. ```swift func installCopyMonitor() { NSEvent.addGlobalMonitorForEvents(matching: .keyDown) { event in guard event.modifierFlags.contains(.command) else { return } let keyCode = event.keyCode // 0x08 = C, 0x07 = X guard keyCode == 0x08 || keyCode == 0x07 else { return } self.pendingCopyCheck?.cancel() self.pendingCopyCheck = Task { try? await Task.sleep(nanoseconds: 80_000_000) // 80ms await self.checkForChanges() } } } ``` -------------------------------- ### SQL Query Examples Source: https://deckclip.app/memoir Examples of structured data queries that demonstrate the limitations of semantic similarity for code. ```sql SELECT * FROM users WHERE id = 7 ``` ```sql DELETE FROM sessions WHERE expired = true ``` -------------------------------- ### Install Global Copy Monitor Source: https://deckclip.app/blog/clipboard-monitoring Monitors for Command+C or Command+X key events and triggers a delayed check to allow the system to populate the pasteboard. ```swift func installCopyMonitor() { NSEvent.addGlobalMonitorForEvents(matching: .keyDown) { event in guard event.modifierFlags.contains(.command) else { return } let keyCode = event.keyCode // 0x08 = C, 0x07 = X guard keyCode == 0x08 || keyCode == 0x07 else { return } self.pendingCopyCheck?.cancel() self.pendingCopyCheck = Task { try? await Task.sleep(nanoseconds: 80_000_000) // 80ms await self.checkForChanges() } } } ``` -------------------------------- ### Example of Iterating Tags in HistoryListView.swift Source: https://deckclip.app/changelog This Swift code snippet shows the iteration over 'vm.tags' for cycling through system and user tags in the history list view. ```swift cycleSystemTags ``` ```swift vm.tags ``` -------------------------------- ### Example of Modern NSWorkspace API for Opening Applications Source: https://deckclip.app/changelog This Swift code demonstrates using the modern NSWorkspace API to open an application, specifically Mail, using its bundle ID and a completion handler. ```swift openApplication(at:configuration:completionHandler:) ``` -------------------------------- ### Example Rule Usage in Deck Source: https://deckclip.app/zh-cn/changelog Demonstrates how to use rules with operators like '+' for multiple values and '-' for exclusion, along with date filtering. This format is used for searching within the application. ```plaintext app:"Google Chrome"+Safari -type:code+text -date:26-01-01+26-01-02 ``` -------------------------------- ### Example of Manual Extraction State in Localizable.xcstrings Source: https://deckclip.app/changelog This snippet demonstrates setting the 'extractionState' to 'manual' for a string entry in 'Localizable.xcstrings' to resolve 'no references' warnings without deleting translations. ```plaintext extractionState ``` ```plaintext manual ``` -------------------------------- ### Search Filter Syntax Examples Source: https://deckclip.app/zh-cn/blog/search-architecture Examples of slash-based filters used to refine search queries by application, date, type, language, or size. ```text /app:Xcode ``` ```text /date:7d ``` ```text /type:image ``` ```text /lang:swift ``` ```text /size:>1kb ``` ```text /-app:Safari ``` -------------------------------- ### Example of Substring Trimming Fix in SmartTextService.swift Source: https://deckclip.app/changelog This code snippet refers to a fix for 'Substring' trimming within the SmartTextService.swift file. ```swift Substring ``` -------------------------------- ### Initialize Database State Source: https://deckclip.app/changelog The `isInitialized` flag is set to true only after successful integrity checks, custom SQL function setup, table creation, and migrations. Failed integrity recovery will not result in a false 'ready' state. ```swift isInitialized ``` -------------------------------- ### Example of Bare-Domain URL Regex Adjustment Source: https://deckclip.app/changelog This Swift code snippet refers to the regex used for bare-domain URLs, highlighting the adjustment to avoid matching within protocol prefixes. ```swift http/https/ftp ``` -------------------------------- ### Example of Local URL Normalizer in SmartTextService.swift Source: https://deckclip.app/changelog This Swift code snippet represents a local URL normalizer used in SmartTextService.swift to avoid main-actor isolation issues. ```swift asCompleteURL() ``` -------------------------------- ### Initialize AppKit Project Source: https://deckclip.app/memoir The initial import required to begin interacting with macOS system services. ```Swift import AppKit ``` -------------------------------- ### Implement Keyboard Shortcuts Source: https://deckclip.app/memoir Demonstrates the integration of keyboard shortcuts for user interaction, enabling operations like summoning the app, navigation, pasting, and dismissing without mouse input. ```swift Cmd+P ``` ```swift Arrow keys ``` ```swift Enter ``` ```swift Escape ``` -------------------------------- ### Initialize sqlite-vec Extension Source: https://deckclip.app/blog/search-architecture Attempts to initialize the sqlite-vec extension for SQLite. It first tries static linking and falls back to dynamic loading if the static initialization is not available. ```c // 1. Try static linking / 优先静态链接 if sqlite3_vec_init != nil { sqlite3_vec_init(db, nil, nil) } // 2. Fall back to dynamic loading / 回退到动态加载 else { let candidates = ["vec0", "vec0.dylib", ``` -------------------------------- ### Rule-based Filtering Syntax Source: https://deckclip.app/memoir Example of a slash-prefixed search string used to trigger rule-based filtering in the application. ```text /app:Xcode ``` -------------------------------- ### Visualize System Architecture Source: https://deckclip.app/blog/ai-agent-plugins Mermaid diagram showing the orchestration and model layers. ```mermaid graph TB subgraph Orchestration["编排层 / Orchestration"] AIS[AIService
编排中心 / Orchestrator] end subgraph Providers["模型层 / Model Layer"] PP[AIProviderProtocol] PP --> CGP[ChatGPTProvider] PP --> OAP[OpenAIAPIProvider] PP --> ANP[AnthropicProvid ``` -------------------------------- ### Initialize sqlite-vec Extension in Swift Source: https://deckclip.app/blog/search-architecture This snippet demonstrates how to initialize the sqlite-vec extension by attempting static linking first, followed by a fallback to dynamic loading from a list of candidate library names. ```swift // 1. Try static linking first / 优先静态链接 if sqlite3_vec_init != nil { sqlite3_vec_init(db, nil, nil) } // 2. Fall back to dynamic loading / 回退到动态加载 else { let candidates = ["vec0", "vec0.dylib", "sqlite-vec", "sqlite-vec.dylib"] for name in candidates { if sqlite3_load_extension(db, name, nil, nil) == SQLITE_OK { break } } } ``` -------------------------------- ### Example of Chinese Phone Number Deduplication Source: https://deckclip.app/changelog This code snippet refers to the deduplication of Chinese phone numbers, specifically handling '+86' variants. ```swift +86 ``` -------------------------------- ### Load SQLite Vector Extension Source: https://deckclip.app/blog/search-architecture Demonstrates loading the SQLite vector extension, first attempting static linking and then falling back to dynamic loading of candidate library names. ```swift // 1. Try static linking first / 优先静态链接 if sqlite3_vec_init != nil { sqlite3_vec_init(db, nil, nil) } // 2. Fall back to dynamic loading / 回退到动态加载 else { let candidates = ["vec0", "vec0.dylib", "sqlite-vec", "sqlite-vec.dylib"] for name in candidates { if sqlite3_load_extension(db, name, nil, nil) == SQLITE_OK { break } } } ``` -------------------------------- ### Remove deprecated string transformation example Source: https://deckclip.app/zh-cn/changelog Removed a legacy code snippet from the project to resolve Xcode warnings regarding unused keys. ```javascript transform(input) { return input.toUpperCase(); } ``` -------------------------------- ### JavaScript JSON Formatter Plugin Source: https://deckclip.app/blog/ai-agent-plugins Example of an AI-generated JavaScript plugin that parses and formats JSON input. It includes error handling for invalid JSON. ```javascript // main.js function transform(input) { try { var obj = JSON.parse(input); return JSON.stringify(obj, null, 2); } catch (e) { return "Invalid JSON: " + e.message; } } ```