Multi framework support, react, vue, svelte
- macOS with Xcode command line tools installed
- GCC/Clang compiler (comes with Xcode tools)
- Make utility
- Node.js and pnpm (for WebView development)
./run.sh# Build the application
make
# Build with debug information
make debug
# Run with default configuration
make run
# Clean build artifacts
make clean
# Show project information
make infogcc -Wall -Wextra -std=c99 -DPLATFORM_MACOS -framework Cocoa -framework Foundation -framework WebKit -o desktop_app main.c config.c platform_macos.c webview_framework.c
./desktop_appThe webview/ directory contains a complete React application with:
- React 19 with TypeScript support
- Vite for fast development and building
- ESLint for code quality
- Hot Module Replacement for instant updates
{
"webview": {
"enabled": true,
"developer_extras": true,
"javascript_enabled": true,
"framework": {
"build_command": "pnpm run build",
"dev_command": "pnpm run dev",
"dev_url": "http://localhost:5174",
"build_dir": "dist",
"dev_mode": true
}
}
}- Development Mode: Automatically starts Vite dev server and loads React app
- Production Mode: Builds the React app and serves static files
- Hot Reload: Changes in React code are instantly reflected in the desktop app
- Developer Tools: WebKit inspector available for debugging
The framework includes a comprehensive native menu system with full customization:
{
"menubar": {
"enabled": true,
"show_about_item": true,
"show_preferences_item": true,
"show_services_menu": false,
"file_menu": {
"enabled": true,
"title": "File",
"items": [
{
"title": "New",
"shortcut": "cmd+n",
"action": "new",
"enabled": true,
"separator_after": false
}
]
}
}
}- File Menu - New, Open, Save, Close operations
- Edit Menu - Undo, Redo, Cut, Copy, Paste
- View Menu - Zoom controls
- Window Menu - Minimize, Zoom window
- Help Menu - Documentation and support
- Native keyboard shortcuts (cmd+n, cmd+s, etc.)
- Enable/disable individual items
- Separator lines between groups
- Custom actions and handlers
The application uses JSON configuration files to customize window behavior and platform-specific features.
# Run with default config
./desktop_app
# Run with custom config
./desktop_app my_config.json{
"app": {
"name": "My Desktop App",
"version": "1.0.0",
"bundle_id": "com.example.app"
}
}{
"window": {
"title": "Window Title",
"width": 1200,
"height": 800,
"min_width": 600,
"min_height": 400,
"center": true,
"resizable": true,
"minimizable": true,
"maximizable": true,
"closable": true,
"frameless": false,
"transparent": false
}
}{
"macos": {
"toolbar": {
"enabled": false
}
}
}{
"development": {
"debug_mode": true,
"console_logging": true
}
}- Navigate to the
webview/directory - Install dependencies:
pnpm install - Start development:
pnpm run dev(or let the C app handle it) - Build for production:
pnpm run build
Menu actions are handled in the platform-specific code. To add new actions:
- Add the action to your menu configuration
- Implement the handler in
platform_macos.c(or platform-specific file) - Update the action dispatcher
./desktop_appCreates a standard desktop application with native menus.
Enable WebView in your config and the app will automatically:
- Build your React application
- Start the development server
- Load the React app in a native WebView
- Provide hot reload during development
Create a custom menu structure by modifying the menu sections in your config file.
platform_webview_load_url()- Load a URL in the WebViewplatform_webview_load_html()- Load HTML content directlyplatform_webview_evaluate_javascript()- Execute JavaScript codeplatform_webview_navigate()- Navigate to the configured URL
run_build_command()- Build the web applicationstart_dev_server()- Start development serverstop_dev_server()- Stop development serverget_webview_url()- Get the current WebView URL
