docs/advanced-usage.md
Customize Pake apps with style modifications, JavaScript injection, and container communication.
Remove ads or customize appearance by modifying CSS.
Quick Process:
pnpm run dev for developmentsrc-tauri/src/inject/style.js:const css = `
.ads-banner { display: none !important; }
.header { background: #1a1a1a !important; }
`;
Add custom functionality like keyboard shortcuts.
Implementation:
src-tauri/src/inject/event.jsdocument.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.key === "k") {
// Custom action
}
});
Pake automatically provides user-friendly download error notifications:
Features:
User Experience:
When a download fails, users will see a notification:
Requesting Notification Permission:
To enable notifications, add this to your injected JavaScript:
// Request notification permission on app start
if (window.Notification && Notification.permission === "default") {
Notification.requestPermission();
}
The download system automatically handles:
Send messages between web content and Pake container.
Web Side (JavaScript):
window.__TAURI__.invoke("handle_scroll", {
scrollY: window.scrollY,
scrollX: window.scrollX,
});
Container Side (Rust):
#[tauri::command]
fn handle_scroll(scroll_y: f64, scroll_x: f64) {
println!("Scroll: {}, {}", scroll_x, scroll_y);
}
Configure window properties in pake.json:
{
"windows": {
"width": 1200,
"height": 780,
"fullscreen": false,
"resizable": true
},
"hideTitleBar": true
}
Package local HTML/CSS/JS files:
pake ./my-app/index.html --name my-static-app --use-local-file
Requirements: Pake CLI >= 3.0.0
By default, apps built with Pake do not request camera or microphone access. For sites that require these (for example, video conferencing or voice input), pass the relevant flags at build time:
pake https://chatgpt.com --name ChatGPT --microphone
pake https://meet.google.com --name GoogleMeet --camera --microphone
--microphone — grants microphone access (com.apple.security.device.audio-input)--camera — grants camera access (com.apple.security.device.camera)macOS will prompt the user for permission on first use. Only add these flags for sites that actually need them.
If you need separate apps for the same site, for example two Gmail accounts with different login state, build them with different app names:
pake https://gmail.com --name "Gmail Work"
pake https://gmail.com --name "Gmail Personal"
Pake now generates a different app identifier for each URL + name pair, so these apps can be installed as separate desktop apps instead of resolving to the same app.
For advanced cases, Pake also supports a hidden --identifier option if you need to pin the bundle identifier explicitly:
pake https://gmail.com --name "Gmail Work" --identifier com.example.gmail.work
--multi-instance is different. It only allows multiple processes for the same packaged app, it does not create separate app identities.
Understanding Pake's codebase structure will help you navigate and contribute effectively:
├── bin/ # CLI source code (TypeScript)
│ ├── builders/ # Platform-specific builders
│ ├── helpers/ # Utility functions
│ └── options/ # CLI option processing
├── docs/ # Project documentation
├── src-tauri/ # Tauri application core
│ ├── src/
│ │ ├── app/ # Core modules (window, tray, shortcuts)
│ │ ├── inject/ # Web page injection logic
│ │ └── lib.rs # Application entry point
│ ├── icons/ # macOS icons (.icns)
│ ├── png/ # Windows/Linux icons (.ico, .png)
│ ├── pake.json # App configuration
│ └── tauri.*.conf.json # Platform-specific configs
├── scripts/ # Build and utility scripts
└── tests/ # Test suites
bin/): TypeScript-based command interface for packaging appssrc-tauri/): Rust-based desktop frameworksrc-tauri/src/inject/): Custom CSS/JS injection for webpagesmacOS:
xcode-select --installWindows:
CRITICAL: Consult Tauri prerequisites before proceeding
Windows 10 SDK (10.0.19041.0) and Visual Studio Build Tools 2022 (≥17.2)
Required redistributables:
Windows ARM (ARM64) support: Install C++ ARM64 build tools in Visual Studio Installer under "Individual Components" → "MSVC v143 - VS 2022 C++ ARM64 build tools"
Linux (Ubuntu):
sudo apt install libdbus-1-dev \
libsoup-3.0-dev \
libjavascriptcoregtk-4.1-dev \
libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
file \
libxdo-dev \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
gnome-video-effects \
gnome-video-effects-extra \
libglib2.0-dev \
pkg-config
# Clone the repository
git clone https://github.com/tw93/Pake.git
cd Pake
# Install dependencies
pnpm install
# Start development
pnpm run dev
bin/, then run pnpm run cli:buildsrc-tauri/src/, then run pnpm run devsrc-tauri/src/inject/ for web customizationspnpm test for comprehensive validationpnpm run dev (hot reload)pnpm run buildpnpm run build:debugpnpm run cli:buildFor CLI development with hot reloading, modify the DEFAULT_DEV_PAKE_OPTIONS configuration in bin/defaults.ts:
export const DEFAULT_DEV_PAKE_OPTIONS: PakeCliOptions & { url: string } = {
...DEFAULT_PAKE_OPTIONS,
url: "https://weekly.tw93.fun/en",
name: "Weekly",
};
Then run:
pnpm run cli:dev
This script reads the configuration and packages the specified app in watch mode, with hot updates for pake-cli code changes.
Comprehensive CLI build and release validation guidance for multi-platform packaging.
# Complete test suite (recommended)
pnpm test # Build the CLI, run the Vitest suite, then run real build + release workflow smoke tests
# Skip the real build and release workflow smoke tests
pnpm test -- --no-build
# Run the fast Vitest suite only
npx vitest run
# Build the CLI explicitly
pnpm run cli:build
# Run the release workflow smoke test directly
node ./tests/release.js
pnpm test runs the main CLI test runner in tests/index.js, which:--no-build is passed,Useful optional flags:
--no-unit: skip unit tests--no-integration: skip integration tests--no-builder: skip builder tests--no-build: skip the real build smoke test and the follow-up release workflow smoke test--e2e: add end-to-end configuration tests--pake-cli: add GitHub Actions related checksIf you only want the release workflow smoke test, run node ./tests/release.js directly.
pnpm run cli:buildrustup updatecargo clean in src-tauri/ directorynode_modules and run pnpm installsudo xcode-select --reset