A lightweight system monitoring tool prototype for macOS, designed to detect CPU, memory, and network status in real-time(more would be added).
My first attempt at Vibe Coding(I used Chinese prompt so you could find Chinese comments among codes), documenting the complete process from technology stack selection to resolving underlying macOS environment conflicts.
- Window Characteristics: Features a semi-transparent, frameless floating window design, supporting drag-and-drop positioning via the top area.
- Run Mode: Configured as an Accessory application to avoid occupying Dock space.
- Real-time Monitoring:
- CPU: Displays usage percentage and logical cores.
- Memory: Displays used capacity / total capacity (GB) and real-time usage percentage.
- Network: Displays real-time download speed, supporting automatic switching between KB/s and MB/s.
- Frontend: Pure native HTML / JavaScript (Vanilla)
- Backend: Rust + sysinfo library
- Framework: Tauri v2
Before running the project, ensure the following are installed on your system:
- Node.js and npm
- Xcode Command Line Tools (
xcode-select --install) - Rust compilation environment (rustup)
The project was generated using the official Tauri CLI. The specific configuration path is as follows:
-
Execute the creation command:
npm create tauri-app@latest mac-sysmon -- --template vanilla
-
Select the following configurations based on the wizard:
- Identifier:
com.cherongtian.mac-sysmon - Choose which language to use for your frontend:
TypeScript / JavaScript - Choose your package manager:
npm - Choose your UI template:
Vanilla(Pure native web page without frameworks) - Choose your UI flavor:
JavaScript(To keep logic minimal)
- Identifier:
-
Install dependencies and enter the directory:
cd mac-sysmon npm install
Start the development mode in the project root directory:
npm run tauri devNote: The current version displays the monitoring panel directly via the main window (visible: true). Due to macOS menu bar icon specification requirements and physical obstruction from the hardware "notch," the tray icon display is temporarily disabled. All data interaction is currently handled through the floating window on the screen.
- Permissions: Manually added the
core:window:allow-start-draggingpermission incapabilities/default.jsonto enable frameless window dragging. - API Calls: Enabled
withGlobalTauriintauri.conf.jsonto support frontend listening for Rust backend data. - Private API: Enabled
macOSPrivateApito support native transparency effects for the Webview.
Since the initial MVP, the following features and deep optimizations have been implemented:
- Added Disk & Temperature Monitoring: Integrated
disk_usage(total physical disk space usage) andtemp(CPU temperature) via thesysinfolibrary. - Frontend UI Completion: Added corresponding DOM elements in
src/index.htmland rendering logic insrc/main.jsto neatly display all 5 data points in the floating window.
- Frontend Sleep Mode (Visibility Detection): The Rust backend now checks
is_visible()andis_minimized(). JSON data is only serialized and emitted to the frontend when the floating window is actively displayed on the screen. If minimized or hidden, the frontend sleeps entirely, ensuring near-zero CPU usage. - Tray Debounce Rendering: Introduced a
last_tray_titlecache in the Rust loop. The application only sends tray redraw requests to macOS when the underlying data visually changes, significantly reducing system rendering overhead.
- Dock Icon Restored: Removed the
ActivationPolicy::Accessoryrestriction. The application icon now displays in the bottom Dock while seamlessly coexisting with the top-right menu bar tray. - Native Animations: Rewrote the tray and Dock click logic. Clicking either the tray icon or the Dock icon now triggers macOS's native
minimize()andunminimize()window behaviors, providing a fluid "suck/pop" scaling animation.
- Minimalist Tray Icon: Replaced lengthy dynamic text strings in the menu bar with a fixed, minimalist text symbol:
≥ ε) ≤to prevent overlap with the MacBook "notch" and avoid visual clutter. - Custom Application Icon: Replaced the default Tauri mascot with a custom logo. The custom image has been placed in the folder. To automatically generate and apply all required macOS application icons (for the Dock,
.icns, etc.), run the following command in the project root:npm run tauri icon "path to your logo.png" (I left one sample in the folder)
- Zero Warnings: Cleaned up unused variables (e.g., renaming
trayto_tray) and fixed Tauri v2 chain-calling type inference bugs to ensure a clean compilation output.