macOS menu bar application for expanding psh directives in any text field.
- Global Hotkey: Press
Cmd+Shift+;to expand psh directives in focused text - Accessibility Integration: Reads and writes text from any application
- Live Preview: Shows expansion preview with warnings before applying
- Menu Bar App: Runs in the background, no dock icon
- macOS 13.0 or later
- Xcode 14.0 or later
- Rust toolchain (for building the FFI library)
-
Build the Rust FFI library:
./build-rust.sh
-
Build the Swift app:
swift build
-
Run the app:
swift run
The app requires accessibility permissions to read and write text in other applications.
On first launch, the app will request these permissions. You'll need to:
- Open System Settings → Privacy & Security → Accessibility
- Enable permissions for PshMacOS
- Restart the app
The app looks for snippets in the following locations (in order):
~/.config/psh/snippets.toml(user config)- Bundled
snippets.toml(app resources) ../snippets.toml(development mode)
To use custom snippets, create ~/.config/psh/snippets.toml:
mkdir -p ~/.config/psh
cp ../snippets.toml ~/.config/psh/- Launch the app - A semicolon icon appears in the menu bar
- Focus any text field in any application
- Type a psh directive (e.g.,
;;d,ne) - Press
Cmd+Shift+;to trigger expansion - Review the preview in the overlay window
- Press Enter to apply or Esc to cancel
┌─────────────────────────────────────────┐
│ macOS Application │
│ ┌───────────────────────────────────┐ │
│ │ AppCoordinator │ │
│ │ - Manages app lifecycle │ │
│ │ - Coordinates components │ │
│ └───────────────────────────────────┘ │
│ │ │ │ │
│ ┌─────┘ ┌────┘ └────┐ │
│ ▼ ▼ ▼ │
│ ┌──────┐ ┌──────┐ ┌──────┐ │
│ │Hotkey│ │Access│ │ Psh │ │
│ │Mgr │ │Mgr │ │Engine│ │
│ └──────┘ └──────┘ └──────┘ │
│ │ │
│ ▼ │
│ ┌──────┐ │
│ │ FFI │ │
│ │Bridge│ │
│ └──────┘ │
└──────────────────────────────┼───────────┘
│
▼
┌─────────────────┐
│ Rust psh-core │
│ (via psh-ffi) │
└─────────────────┘
- main.swift: App entry point and menu bar setup
- AppCoordinator.swift: Main coordinator managing app flow
- PshWrapper.swift: Swift wrapper around C FFI
- AccessibilityManager.swift: Reads/writes text via AX API
- HotkeyManager.swift: Global hotkey registration (Cmd+Shift+;)
- OverlayWindow.swift: SwiftUI preview overlay
swift runswift build -c releaseThe executable will be at .build/release/PshMacOS.
Enable verbose logging by setting environment variable:
RUST_LOG=debug swift run- Grant permissions in System Settings → Privacy & Security → Accessibility
- Restart the app after granting permissions
- Ensure
~/.config/psh/snippets.tomlexists - Or run from the project directory (development mode)
- Check if another app is using
Cmd+Shift+; - Try restarting the app
- Check Console.app for error messages
- Some apps don't support accessibility API (e.g., password fields)
- Try a different text field
- Check accessibility permissions
Same as parent project.