feat(profile): add --profile flag for isolated instances - #241
feat(profile): add --profile flag for isolated instances#241TimeToBuildBob wants to merge 3 commits into
Conversation
Mirrors aw-qt#128 / aw-server-rust#652. --testing is an alias for --profile testing, AW_PROFILE is exported for spawned modules, and named profiles get a sibling activitywatch-<profile> dir root. default and testing keep the bare activitywatch root.
Greptile SummaryThis PR adds named ActivityWatch profiles, propagates them to spawned modules, isolates profile-owned paths and Linux single-instance state, and labels profile-specific UI surfaces. The macOS autostart fix reintroduces a launcher backend previously reverted for failing to start ActivityWatch at login.
Confidence Score: 4/5The PR should not merge until named-profile macOS autostart avoids or fixes the LaunchAgent startup failure previously observed in this application. Named macOS profiles now use the same LaunchAgent backend that was previously reverted because it could leave ActivityWatch closed after login, and this change only adds profile arguments without addressing that launch failure. Files Needing Attention: src-tauri/src/lib.rs Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Resolve CLI or AW_PROFILE] --> B[Export AW_PROFILE]
B --> C[Select profile directories]
B --> D[Start embedded server and modules]
B --> E[Configure single-instance identity]
B --> F{macOS autostart profile}
F -->|default| G[AppleScript]
F -->|named| H[LaunchAgent with --profile]
H --> I[Login launch may fail]
Reviews (3): Last reviewed commit: "fix(profile): use LaunchAgent for named ..." | Re-trigger Greptile |
Digit-leading profiles (e.g. '1work') pass the alphanumeric check but produce invalid D-Bus well-known-name elements on Linux, preventing single-instance registration and startup. Fix: require the first char to be a letter (is_ascii_alphabetic). Autostart did not preserve the selected profile: the OS login item was registered without arguments, so every relaunch resolved to 'default'. Fix: pass ['--profile', name] to tauri_plugin_autostart::init when the active profile is not 'default'. Addresses Greptile P1 findings on PR ActivityWatch#241.
|
Fixed both P1 findings from Greptile (afc205a): 1. Digit-leading profiles break D-Bus ( 2. Autostart loses selected profile ( |
|
@greptileai review |
AppleScript login items silently discard extra arguments, so --profile was dropped on relogin. LaunchAgent creates a plist with ProgramArguments that preserves --profile, ensuring the correct instance starts on boot. Default profile keeps AppleScript (visible in System Settings login items). Named profiles use LaunchAgent (correct args in ~/Library/LaunchAgents/). Fixes Greptile P1: macOS autostart drops profiles.
|
Fixed all three Greptile P1 findings: 1. Digit-leading profiles break D-Bus (profile.rs) — fixed in afc205a: first-character check now requires 2. Autostart loses selected profile (main.rs) — fixed in afc205a: pass 3. macOS autostart drops profiles (lib.rs) — fixed in f06ea22: switch to |
|
@greptileai review |
|
Greptile review converged after 3 rounds. Summary: Fixed (3 P1 findings):
Remaining (non-blocking, documented tradeoff):
CI: All checks pass (clippy, format, release builds for Linux/macOS/Windows; one Windows ARM job still pending but not blocking). Domain risk for manual testing: macOS named-profile autostart with login — LaunchAgent plist generation and Ready for maintainer review and merge. |
Launcher half of isolated profiles (ActivityWatch/activitywatch#1399). Same contract as ActivityWatch/aw-qt#128 and ActivityWatch/aw-server-rust#652.
--profile NAME(lowercase alnum +-/_, max 32).--testingis an alias for--profile testing; conflicting values are a usage error.AW_PROFILEso spawned modules inherit the profile without every CLI growing a flag.AW_PROFILEis also a fallback when--profileis absent.dirs.rsappname():defaultandtestingkeep the bareactivitywatchroot (existing installs stay put); any other profile gets a siblingactivitywatch-<profile>root. Isolates config/data/logs/runtime with no per-module path changes.default. Custom profiles using port 5600 log a warning.The embedded
aw-serverstill takes thetesting: boolAPI until ActivityWatch/aw-server-rust#652 merges and the crate pin is bumped. Spawned Python watchers pick upAW_PROFILEthe same way, once aw-core grows the matchingdirschange.