Python Sidecar
The sidecar (sidecar/kalam-core.py, compiled to kalam-core-x86_64-pc-windows-msvc.exe) handles all system-level operations. The frontend communicates with it via @tauri-apps/plugin-shell Command.sidecar().
CLI Reference
| Command | Args | Output | Description |
|---|---|---|---|
list | — | JSON [{id, name}] | List all profiles |
current | — | {id, name} or null | Currently active profile |
apply-by-name | "Profile Name" | (none) | Look up and apply by name |
<numeric_id> | — | (none) | Apply profile by numeric ID |
scan | — | (writes manifest files) | Scan all tool configs |
autodetect | — | JSON paths | Auto-detect tool install paths |
stop-all | — | Status text | Stop all managed tools |
Profile Application Flow
apply_profile() orchestrates the full sequence:
- Fetch running processes once (cached as
running_namesset) - Apply each tool in order: Rainmeter → Wallpaper → YASB → GlazeWM → Zebar → Windhawk
- For each tool: check if config exists → write config → start/restart process
- If a tool is not in the profile but is running → kill it
- Set
activeProfilein settings
Tool-Specific Logic
| Tool | Apply Function | What It Does |
|---|---|---|
| Rainmeter | rainmeter() | Starts exe if not running, loads layout via !LoadLayout |
| YASB | yasb_code_inject() | Writes config.yaml + styles.css, starts exe if needed |
| GlazeWM | glaze_wm_apply() | Writes config.yaml, kills with graceful exit command, restarts |
| Zebar | zebar_apply() | Writes settings.json, kills and restarts |
| Windhawk | apply_windhawk_profile() | Installed: writes .reg file, runs elevated via ShellExecuteExW with runas; Portable: kills and restarts |
| Wallpaper | set_wallpaper_all_desktops() | Uses pyvda to set wallpaper across virtual desktops |
Process Scan Optimization
kill_process(), is_process_running(), rainmeter(), yasb_code_inject(), glaze_wm_apply(), and zebar_apply() accept an optional running_names parameter (set of lowercase exe names). When provided, they skip redundant psutil.process_iter scans and use the pre-computed set instead. apply_profile() creates the set internally and threads it through the individual tool functions.
Windhawk Smart Restart
When applying profiles with Windhawk-Mods, the sidecar compares desired settings against current registry via _windhawk_settings_changed(). If nothing changed — re-applying the same profile or switching between profiles with identical Windhawk configs — the registry write, elevation, and service restart are skipped entirely. This avoids unnecessary UAC prompts and service interruptions.
Both scan_windhawk_registry() and _get_current_windhawk_settings() share _enumerate_windhawk_registry(), which reads from HKLM and HKCU under SOFTWARE\Windhawk\Engine\Mods and SOFTWARE\Windhawk\Mods, returning a deduplicated list.
Auto-Detect Paths
autodetect_paths() resolves tool paths dynamically using environment-aware lookups:
| Helper | Purpose |
|---|---|
_first_existing(iterable) | Returns first path that os.path.exists(), or "" |
_program_files_dirs() | Reads %ProgramW6432%, %ProgramFiles%, %ProgramFiles(x86)% — called once and reused |
Detection order per tool: shutil.which() → _program_files_dirs() + tool name → %LOCALAPPDATA%\Programs\<Tool> → %LOCALAPPDATA%\Microsoft\WinGet\Links\<Tool>
Known Config Paths
- YASB:
YASB_CONFIG_HOMEenv →~/.config/yasb/→~/.yasb/ - GlazeWM:
~/.glzr/glazewm/→~/.glazewm/ - Zebar:
%APPDATA%/zebar→~/.zebar/
Sidecar Internal Refactors
_enumerate_windhawk_registry()— shared helper, eliminates duplicate registry enumeration_parse_rainmeter_ini()— handles both UTF-16-LE and UTF-8 encodings ofRainmeter.ini_program_files_dirs()— called once perautodetect_paths()instead of per toolkill_process()—breakafter successful kill to avoid scanning remaining processesscan_zebar_configs()— removed redundantjson.loads()validation
Windhawk Mod Schema
{
"id": "modernflyouts",
"enabled": 1,
"settings": { "show-labels": true, "animation-speed": 200 }
}