- Configure Tauri v2 for macOS, Windows, Linux - Implement native menu bar (File, Edit, View, Window, Help) - Add system tray with show/hide/quit functionality - Create auto-updater framework with periodic checks - Set up window state persistence - Configure plugins (fs, http, dialog, shell, store) - Add build scripts for all platforms - Include comprehensive documentation Files: - src-tauri/Cargo.toml - src-tauri/tauri.conf.json - src-tauri/build.rs - src-tauri/src/main.rs - src-tauri/src/lib.rs - src-tauri/src/menu.rs - src-tauri/src/tray.rs - src-tauri/src/updater.rs - src-tauri/Cargo.lock - src-tauri/icons/tray-icon.svg - src-tauri/tauri.build.conf - src-tauri/README.md - .gitignore - package.json (Tauri CLI scripts)
189 lines
3.9 KiB
Markdown
189 lines
3.9 KiB
Markdown
# FrenoCorp Desktop (Tauri)
|
|
|
|
Cross-platform desktop application built with Tauri v2.
|
|
|
|
## Architecture
|
|
|
|
```
|
|
src-tauri/
|
|
├── src/
|
|
│ ├── main.rs # Application entry point
|
|
│ ├── lib.rs # Library exports
|
|
│ ├── menu.rs # Native menu bar
|
|
│ ├── tray.rs # System tray
|
|
│ └── updater.rs # Auto-updater logic
|
|
├── icons/ # App icons
|
|
├── Cargo.toml # Rust dependencies
|
|
├── tauri.conf.json # Tauri configuration
|
|
└── build.rs # Build script
|
|
```
|
|
|
|
## Platform Support
|
|
|
|
- **macOS**: 10.15+ (Catalina and later)
|
|
- **Windows**: 10+ (WebView2 required)
|
|
- **Linux**: Ubuntu 18.04+, Debian 10+, or equivalent (WebKit2GTK required)
|
|
|
|
## Development
|
|
|
|
### Prerequisites
|
|
|
|
**macOS:**
|
|
```bash
|
|
brew install pkg-config libappindicator
|
|
```
|
|
|
|
**Windows:**
|
|
```bash
|
|
# WebView2 is automatically installed on Windows 10+
|
|
# For development:
|
|
winget install Microsoft.VisualStudio.2022.Community
|
|
```
|
|
|
|
**Linux:**
|
|
```bash
|
|
# Ubuntu/Debian
|
|
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev
|
|
|
|
# Fedora
|
|
sudo dnf install gtk3-devel webkit2gtk4.0-devel
|
|
```
|
|
|
|
### Running in Development
|
|
|
|
```bash
|
|
# From project root
|
|
npm run tauri:dev
|
|
```
|
|
|
|
This starts both the Vite dev server and the Tauri application.
|
|
|
|
### Building for Production
|
|
|
|
```bash
|
|
# Build for current platform
|
|
npm run tauri:build
|
|
|
|
# Build for specific platform
|
|
npm run tauri:build:macos
|
|
npm run tauri:build:windows
|
|
npm run tauri:build:linux
|
|
```
|
|
|
|
### Output Locations
|
|
|
|
- **macOS**: `src-tauri/target/release/bundle/macos/`
|
|
- **Windows**: `src-tauri/target/release/bundle/msi/` and `/msi/`
|
|
- **Linux**: `src-tauri/target/release/bundle/deb/` and `/appimage/`
|
|
|
|
## Features
|
|
|
|
### Native Menu Bar
|
|
|
|
Platform-specific menus are implemented in `src/menu.rs`:
|
|
- File menu (New, Open, Save, etc.)
|
|
- Edit menu (Undo, Redo, Cut, Copy, Paste)
|
|
- View menu (Zoom, Fullscreen)
|
|
- Window menu
|
|
- Help menu
|
|
|
|
### System Tray
|
|
|
|
Implemented in `src/tray.rs`:
|
|
- Show/Hide application
|
|
- Quit from tray
|
|
- Platform-specific tray icons
|
|
|
|
### Auto-Updater
|
|
|
|
Implemented in `src/updater.rs`:
|
|
- Check for updates on startup
|
|
- Periodic background checks
|
|
- Download and install updates
|
|
- Platform-specific installation logic
|
|
|
|
### Window State Persistence
|
|
|
|
- Window position and size
|
|
- Maximized state
|
|
- Last known state restoration
|
|
|
|
## Configuration
|
|
|
|
Main configuration is in `tauri.conf.json`:
|
|
- Bundle identifiers
|
|
- Icon paths
|
|
- Window settings
|
|
- Plugin configuration
|
|
- Security settings
|
|
|
|
## Testing
|
|
|
|
```bash
|
|
# Run Rust tests
|
|
cargo test --manifest-path src-tauri/Cargo.toml
|
|
|
|
# Run with logging
|
|
RUST_LOG=debug npm run tauri:dev
|
|
```
|
|
|
|
## Debugging
|
|
|
|
### Enable Debug Logging
|
|
|
|
```bash
|
|
export RUST_LOG=debug
|
|
npm run tauri:dev
|
|
```
|
|
|
|
### View Tauri Logs
|
|
|
|
- **macOS**: `~/Library/Logs/frenocorp-desktop/log.log`
|
|
- **Windows**: `%APPDATA%/frenocorp-desktop/log.log`
|
|
- **Linux**: `~/.cache/frenocorp-desktop/log.log`
|
|
|
|
## Dependencies
|
|
|
|
See `Cargo.toml` for complete list. Key dependencies:
|
|
|
|
- `tauri v2` - Core framework
|
|
- `tauri-plugin-fs` - File system access
|
|
- `tauri-plugin-http` - HTTP requests
|
|
- `tauri-plugin-dialog` - Native dialogs
|
|
- `tauri-plugin-shell` - Shell commands
|
|
- `tauri-plugin-store` - State persistence
|
|
- `tokio` - Async runtime
|
|
|
|
## CI/CD Integration
|
|
|
|
The build scripts are designed for CI/CD integration:
|
|
|
|
```yaml
|
|
# Example GitHub Actions
|
|
- name: Build macOS
|
|
run: npm run tauri:build:macos
|
|
|
|
- name: Build Windows
|
|
run: npm run tauri:build:windows
|
|
|
|
- name: Build Linux
|
|
run: npm run tauri:build:linux
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### Common Issues
|
|
|
|
1. **WebView2 not found (Windows)**
|
|
- Install WebView2 runtime or enable auto-download
|
|
|
|
2. **GTK not found (Linux)**
|
|
- Install libgtk-3-dev and libwebkit2gtk-4.0-dev
|
|
|
|
3. **Code signing failed (macOS)**
|
|
- Configure signing identity in tauri.conf.json
|
|
- Or disable for development
|
|
|
|
4. **Permission denied (Linux)**
|
|
- Ensure proper file permissions on build artifacts
|