Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.10.4] - 2026-11-04

### Added
- Right-click (or Control-click) the menu-bar icon for a menu: **Check for Updates…** (or **Install Update X.Y.Z…** once one is found), Settings, About and Quit.

## [2.10.3] - 2026-11-04

### Changed
Expand Down
8 changes: 4 additions & 4 deletions Maccy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2017,7 +2017,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 83;
CURRENT_PROJECT_VERSION = 84;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -2034,7 +2034,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 2.10.3;
MARKETING_VERSION = 2.10.4;
PRODUCT_BUNDLE_IDENTIFIER = com.royp.MaccyPlus;
PRODUCT_NAME = "MaccyPlus";
PRODUCT_MODULE_NAME = Maccy;
Expand All @@ -2056,7 +2056,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 83;
CURRENT_PROJECT_VERSION = 84;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -2072,7 +2072,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 2.10.3;
MARKETING_VERSION = 2.10.4;
PRODUCT_BUNDLE_IDENTIFIER = com.royp.MaccyPlus;
PRODUCT_NAME = "MaccyPlus";
PRODUCT_MODULE_NAME = Maccy;
Expand Down
29 changes: 29 additions & 0 deletions Maccy/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
statusItem.behavior = .removalAllowed
statusItem.button?.action = #selector(performStatusItemClick)
statusItem.button?.sendAction(on: [.leftMouseDown, .rightMouseUp]) // MaccyPlus: right-click menu
statusItem.button?.image = Defaults[.menuIcon].image
statusItem.button?.imagePosition = .imageLeft
statusItem.button?.target = self
Expand Down Expand Up @@ -216,6 +217,12 @@ class AppDelegate: NSObject, NSApplicationDelegate {
.union(NSEvent.modifierFlags)
.intersection(.deviceIndependentFlagsMask)

// MaccyPlus: right-click or control-click opens the menu; left-click is unchanged.
if NSApp.currentEvent?.type == .rightMouseUp || modifierFlags.contains(.control) {
showStatusMenu()
return
}

if modifierFlags.contains(.option) {
Defaults[.ignoreEvents].toggle()

Expand All @@ -229,6 +236,28 @@ class AppDelegate: NSObject, NSApplicationDelegate {
panel.toggle(height: AppState.shared.popup.height, at: .statusItem)
}

private func showStatusMenu() {
guard let button = statusItem.button else { return }
let menu = NSMenu()
func item(_ title: String, _ action: Selector, key: String = "") {
let item = NSMenuItem(title: title, action: action, keyEquivalent: key)
item.target = self
menu.addItem(item)
}
item(SoftwareUpdater.shared.menuTitle, #selector(statusMenuCheckForUpdates))
menu.addItem(.separator())
item("Settings…", #selector(statusMenuSettings), key: ",")
item("About MaccyPlus", #selector(statusMenuAbout))
menu.addItem(.separator())
item("Quit MaccyPlus", #selector(NSApplication.terminate(_:)), key: "q")
menu.items.last?.target = NSApp
menu.popUp(positioning: nil, at: NSPoint(x: 0, y: button.bounds.height + 5), in: button)
}

@objc private func statusMenuCheckForUpdates() { SoftwareUpdater.shared.checkForUpdates() }
@objc private func statusMenuSettings() { AppState.shared.openPreferences() }
@objc private func statusMenuAbout() { AppState.shared.openAbout() }

private func synchronizeMenuIconText() {
_ = withObservationTracking {
AppState.shared.menuIconText
Expand Down
21 changes: 19 additions & 2 deletions Maccy/SoftwareUpdater.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ class SoftwareUpdater {
}
}

/// Version of an update Sparkle found that is not installed yet; nil when none is known.
var availableVersion: String?
/// Title for the status-item menu: offers a found update, else a manual check.
var menuTitle: String {
availableVersion.map { "Install Update \($0)…" } ?? "Check for Updates…"
}

private var updater: SPUUpdater
private var automaticallyChecksForUpdatesObservation: NSKeyValueObservation?

private let updaterController = SPUStandardUpdaterController(
startingUpdater: true,
updaterDelegate: nil,
updaterDelegate: UpdateAlertPresenter.shared,
userDriverDelegate: UpdateAlertPresenter.shared
)

Expand Down Expand Up @@ -46,9 +53,19 @@ class SoftwareUpdater {
/// MaccyPlus: a menu-bar-only app's scheduled update alert opens behind other windows, with no Dock
/// icon to find it by. Dock icon + front while the alert is up, back to accessory when it closes.
// @unchecked Sendable: no stored state.
nonisolated final class UpdateAlertPresenter: NSObject, SPUStandardUserDriverDelegate, @unchecked Sendable {
nonisolated final class UpdateAlertPresenter: NSObject, SPUUpdaterDelegate, SPUStandardUserDriverDelegate, @unchecked Sendable {
static let shared = UpdateAlertPresenter()

// Sparkle calls these on the main thread; its header just doesn't say so to Swift.
func updater(_ updater: SPUUpdater, didFindValidUpdate item: SUAppcastItem) {
let version = item.displayVersionString
MainActor.assumeIsolated { SoftwareUpdater.shared.availableVersion = version }
}

func updaterDidNotFindUpdate(_ updater: SPUUpdater, error: any Error) {
MainActor.assumeIsolated { SoftwareUpdater.shared.availableVersion = nil }
}

var supportsGentleScheduledUpdateReminders: Bool { true }

// Sparkle calls these on the main thread; its header just doesn't say so to Swift.
Expand Down
Loading