Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

app: sync macOS update menu and icon at startup (#18622)

Eva H9eae4fac935c
diff --git a/app/cmd/app/app_darwin.m b/app/cmd/app/app_darwin.m
index b544212a5..c5d80c705 100644
--- a/app/cmd/app/app_darwin.m
+++ b/app/cmd/app/app_darwin.m
@@ -549,7 +549,7 @@ static NSImage *ollamaApplicationIcon(void) {
context:nil];
self.statusItem.menu = menu;
- [self showIcon];
+ [self refreshStatusItem];
// Application menu
NSString *appName = @"Ollama";
@@ -748,9 +748,7 @@ static NSImage *ollamaApplicationIcon(void) {
- (void)showUpdateAvailable {
self.updateAvailable = YES;
- [self.updateAvailableMenuItem setHidden:NO];
- [self.restartMenuItem setHidden:NO];
- [self showIcon];
+ [self refreshStatusItem];
}
- (void)aboutOllama {
@@ -1491,7 +1489,10 @@ didCompleteWithError:(NSError *)error {
return NO;
}
-- (void)showIcon {
+- (void)refreshStatusItem {
+ [self.updateAvailableMenuItem setHidden:!self.updateAvailable];
+ [self.restartMenuItem setHidden:!self.updateAvailable];
+
NSAppearance *appearance = self.statusItem.button.effectiveAppearance;
NSString *appearanceName = (NSString *)(appearance.name);
NSString *iconName = @"ollama";
@@ -1518,7 +1519,7 @@ didCompleteWithError:(NSError *)error {
ofObject:(id)object
change:(NSDictionary<NSKeyValueChangeKey, id> *)change
context:(void *)context {
- [self showIcon];
+ [self refreshStatusItem];
}
- (void)hide {
@@ -1868,9 +1869,10 @@ decidePolicyForNavigationAction:(WKNavigationAction *)action
AppDelegate *appDelegate;
void run(bool so, bool sh) {
+ // Retain update notifications that arrive while AppKit initializes.
+ appDelegate = [[AppDelegate alloc] init];
[NSApplication sharedApplication];
[NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
- appDelegate = [[AppDelegate alloc] init];
[NSApp setDelegate:appDelegate];
showOnboarding = so;
startHidden = sh;