Skip to content

Commit cd50267

Browse files
committed
Add custom tray menu branding icon support
1 parent b2db97b commit cd50267

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
### Fixed
99
- Even if `SoftwareUpdates` or `PendingAppUpdates` were hidden, the badge would still be displayed in the tray menu and dock. This has been fixed by checking if the widget is hidden before displaying the badge.
1010

11+
### Added
12+
- A new option to set a custom branding tray menu icon by specifying a base64 string of the icon using `TrayMenuBrandingIcon`. Note that the icon should be a monochrome icon to fit the design of the tray menu.
13+
1114
## [2.2.0] - 2025-01-07
1215
### Changed
1316
- A slight background has been added increasing visaibility of the text.

SupportCompanion/AppDelegate.swift

+5-3
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate {
197197

198198
func updateTrayIcon(hasUpdates: Bool) {
199199
let iconName = "MenuIcon"
200-
let iconPath = appStateManager.preferences.trayMenuBrandingIconPath
200+
let base64Logo = appStateManager.preferences.trayMenuBrandingIcon
201+
var showLogo = false
201202
var baseIcon: NSImage?
202203

203-
if !iconPath.isEmpty && fileManager.fileExists(atPath: iconPath) {
204-
baseIcon = NSImage(contentsOfFile: iconPath)
204+
showLogo = loadLogo(base64Logo: base64Logo)
205+
if showLogo {
206+
baseIcon = NSImage(data: Data(base64Encoded: base64Logo)!)
205207
} else {
206208
baseIcon = NSImage(named: iconName)
207209
}

SupportCompanion/Preferences.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class Preferences: ObservableObject {
8181

8282
@AppStorage("CustomCardsMenuIcon") var customCardsMenuIcon: String = ""
8383

84-
@AppStorage("TrayMenuBrandingIconPath") var trayMenuBrandingIconPath: String = ""
84+
@AppStorage("TrayMenuBrandingIcon") var trayMenuBrandingIcon: String = ""
8585

8686
// MARK: - Actions
8787

0 commit comments

Comments
 (0)