Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(desktop): make keeping the Runtime the default quit choice (#2871)

Maxf7563f05fa00
diff --git a/desktop/src-tauri/src/lib.rs b/desktop/src-tauri/src/lib.rs
index 6632de948..b125f29fb 100644
--- a/desktop/src-tauri/src/lib.rs
+++ b/desktop/src-tauri/src/lib.rs
@@ -727,10 +727,23 @@ enum QuitChoice {
Cancel,
}
+/// The quit question's buttons, in display order. The first is the default
+/// action (Return on macOS), so it is the one that interrupts nothing: keeping
+/// the Runtime lets Agent turns, Watches, scheduled Tasks, IM and remote access
+/// carry on after the window closes. Stopping stays one explicit click away.
+/// [`quit_choice`] maps positional results by this same order.
+fn quit_dialog_buttons(catalog: &NativeTrayCatalog) -> MessageDialogButtons {
+ MessageDialogButtons::YesNoCancelCustom(
+ catalog.quit_keep.clone(),
+ catalog.quit_stop.clone(),
+ catalog.cancel.clone(),
+ )
+}
+
fn quit_choice(result: MessageDialogResult, catalog: &NativeTrayCatalog) -> QuitChoice {
match result {
- MessageDialogResult::Yes => QuitChoice::Stop,
- MessageDialogResult::No => QuitChoice::Keep,
+ MessageDialogResult::Yes => QuitChoice::Keep,
+ MessageDialogResult::No => QuitChoice::Stop,
MessageDialogResult::Custom(label) if label == catalog.quit_stop => QuitChoice::Stop,
MessageDialogResult::Custom(label) if label == catalog.quit_keep => QuitChoice::Keep,
_ => QuitChoice::Cancel,
@@ -857,11 +870,7 @@ fn request_runtime_lifecycle(app: AppHandle, quit: bool) {
app.dialog()
.message(catalog.quit_message.clone())
.title(catalog.quit_title.clone())
- .buttons(MessageDialogButtons::YesNoCancelCustom(
- catalog.quit_stop.clone(),
- catalog.quit_keep.clone(),
- catalog.cancel.clone(),
- ))
+ .buttons(quit_dialog_buttons(&catalog))
.show_with_result(move |result| {
match quit_choice(result, &catalog) {
QuitChoice::Stop => stop_runtime(callback_app.clone(), true),
@@ -2280,6 +2289,28 @@ mod tests {
}
}
+ #[test]
+ fn quit_dialog_defaults_to_keeping_the_runtime_and_maps_positions_by_label() {
+ for locale in ["en-US", "zh-CN"] {
+ let catalog = native_catalog_for_locales([locale.to_owned()]).tray;
+ let MessageDialogButtons::YesNoCancelCustom(first, second, third) = quit_dialog_buttons(&catalog) else {
+ panic!("the quit question offers three custom buttons");
+ };
+ assert_eq!(first, catalog.quit_keep, "the default button keeps the Runtime");
+ // A platform may answer by position or by label; both must agree.
+ for (position, label) in [
+ (MessageDialogResult::Yes, first),
+ (MessageDialogResult::No, second),
+ (MessageDialogResult::Cancel, third),
+ ] {
+ assert_eq!(
+ quit_choice(position, &catalog),
+ quit_choice(MessageDialogResult::Custom(label), &catalog)
+ );
+ }
+ }
+ }
+
#[cfg(target_os = "macos")]
#[test]
fn computer_use_catalog_contains_screen_recording_recovery_guidance_in_each_locale() {
diff --git a/docs/plans/desktop-tray-lifecycle.md b/docs/plans/desktop-tray-lifecycle.md
index dc6b61083..7252c8549 100644
--- a/docs/plans/desktop-tray-lifecycle.md
+++ b/docs/plans/desktop-tray-lifecycle.md
@@ -13,8 +13,9 @@ three-failure recovery threshold remains unchanged.
Stop is offered only for this app's own Runtime. Confirmation stops it without
exiting the shell. The bootstrap then shows a localized stopped notice and an
explicit Retry action; automatic recovery must not undo a user's Stop.
-Quit while this app's Runtime serves offers stop-and-quit, keep-running-and-quit,
-or cancel. Quit otherwise leaves the adopted Runtime alone. Startup and
+Quit while this app's Runtime serves offers keep-running-and-quit (the default
+button, since it interrupts nothing), stop-and-quit, or cancel. Quit otherwise
+leaves the adopted Runtime alone. Startup and
uninstall serialize against lifecycle actions; no stop may race a launch.
Start at Login is a native checkable menu item backed by
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index b3cd0799b..01cf9db64 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -37,7 +37,7 @@
"stopMessage": "Stop the Runtime started by this app? Active work will be interrupted. The desktop app stays open and your data is preserved.",
"stopAction": "Stop Runtime",
"quitTitle": "Quit Avibe",
- "quitMessage": "This app started the Runtime. Stop it when quitting, or keep it running so active work can continue?",
+ "quitMessage": "This app started the Runtime. Keep it running so active work can continue, or stop it when quitting?",
"quitStop": "Quit and stop Runtime",
"quitKeep": "Keep Runtime running",
"cancel": "Cancel",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index a45e407e7..ae16ff6ce 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -37,7 +37,7 @@
"stopMessage": "要停止由本应用启动的运行时吗?正在进行的工作会被中断。桌面应用将保持打开,你的数据会被保留。",
"stopAction": "停止运行时",
"quitTitle": "退出应用",
- "quitMessage": "运行时由本应用启动。退出时要将其停止,还是让它继续运行以完成正在进行的工作?",
+ "quitMessage": "运行时由本应用启动。要让它继续运行以完成正在进行的工作,还是在退出时将其停止?",
"quitStop": "退出并停止运行时",
"quitKeep": "保持运行时运行",
"cancel": "取消",