Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat: add 'Check for updates' to dock right-click menu

Louis Beaumontd794176a0a3d
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 4b90c0573..5e0d39072 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -119,6 +119,19 @@ fn setup_dock_menu(app_handle: AppHandle) {
}
}
}
+ extern "C" fn check_updates(_this: &Object, _sel: Sel, _sender: id) {
+ unsafe {
+ if let Some(ref app) = DOCK_APP_HANDLE {
+ let app = app.clone();
+ tauri::async_runtime::spawn(async move {
+ let state = app.state::<crate::updates::UpdatesManager>();
+ if let Err(e) = state.check_for_updates(true).await {
+ tracing::error!("dock menu: check for updates failed: {}", e);
+ }
+ });
+ }
+ }
+ }
extern "C" fn dock_menu(_this: &Object, _sel: Sel, _sender: id) -> id {
unsafe {
let menu: id = msg_send![class!(NSMenu), new];
@@ -141,6 +154,15 @@ fn setup_dock_menu(app_handle: AppHandle) {
let _: () = msg_send![item, setTarget: _this];
let _: () = msg_send![menu, addItem: item];
+ // "Check for updates"
+ let title = NSString::alloc(nil).init_str("Check for updates");
+ let action = sel!(checkUpdates:);
+ let key = NSString::alloc(nil).init_str("");
+ let item: id = msg_send![class!(NSMenuItem), alloc];
+ let item: id = msg_send![item, initWithTitle:title action:action keyEquivalent:key];
+ let _: () = msg_send![item, setTarget: _this];
+ let _: () = msg_send![menu, addItem: item];
+
// Note: macOS adds native "Quit" to dock menu automatically
menu
}
@@ -151,6 +173,7 @@ fn setup_dock_menu(app_handle: AppHandle) {
let mut decl = objc::declare::ClassDecl::new("ScreenpipeDockMenuDelegate", superclass).unwrap();
decl.add_method(sel!(showScreenpipe:), show_screenpipe as extern "C" fn(&Object, Sel, id));
decl.add_method(sel!(openSettings:), open_settings as extern "C" fn(&Object, Sel, id));
+ decl.add_method(sel!(checkUpdates:), check_updates as extern "C" fn(&Object, Sel, id));
decl.add_method(sel!(applicationDockMenu:), dock_menu as extern "C" fn(&Object, Sel, id) -> id);
let delegate_class = decl.register();