mirror of
https://github.com/munki/munki.git
synced 2026-05-05 03:49:22 -05:00
Add icons to Navigate menu items in macOS 26
This commit is contained in:
+3
-3
@@ -62,9 +62,9 @@ extension MainWindowController: NSOutlineViewDelegate {
|
||||
view.imgView.image = image
|
||||
view.imgView.contentTintColor = isSelected ? .controlAccentColor : .secondaryLabelColor
|
||||
} else if #available(macOS 11.0, *) {
|
||||
if let systemImage = NSImage(systemSymbolName: sidebarItem.icon, accessibilityDescription: nil) {
|
||||
systemImage.isTemplate = true
|
||||
view.imgView.image = systemImage
|
||||
if let image = NSImage(systemSymbolName: sidebarItem.icon, accessibilityDescription: nil) {
|
||||
image.isTemplate = true
|
||||
view.imgView.image = image
|
||||
view.imgView.contentTintColor = isSelected ? .controlAccentColor : .secondaryLabelColor
|
||||
} else {
|
||||
view.imgView.image = nil
|
||||
|
||||
+20
-7
@@ -100,15 +100,28 @@ class MainWindowController: NSWindowController {
|
||||
}
|
||||
// add an item for each sidebar item
|
||||
var index = 1
|
||||
for item in sidebarItems {
|
||||
for sidebarItem in sidebarItems {
|
||||
let key = index < 10 ? String(index) : ""
|
||||
navigateMenu.items.append(
|
||||
NSMenuItem(
|
||||
title: item.title.localized(withComment: "\(item.title) label"),
|
||||
action: #selector(navigationMenuItemClicked),
|
||||
keyEquivalent: key
|
||||
)
|
||||
let menuItem = NSMenuItem(
|
||||
title: sidebarItem.title.localized(withComment: "\(sidebarItem.title) label"),
|
||||
action: #selector(navigationMenuItemClicked),
|
||||
keyEquivalent: key
|
||||
)
|
||||
if #available(macOS 26.0, *) {
|
||||
if let image = NSImage(named: NSImage.Name(sidebarItem.icon))?.copy() as? NSImage {
|
||||
// we make a copy since we're resizing it and this same image is
|
||||
// used in the sidebar (and we don't want it to be the same size
|
||||
// both places)
|
||||
image.isTemplate = true
|
||||
let fontsize = NSFont.menuFont(ofSize: 0.0).pointSize
|
||||
image.size.height = fontsize
|
||||
image.size.width = fontsize
|
||||
menuItem.image = image
|
||||
} else if let image = NSImage(systemSymbolName: sidebarItem.icon, accessibilityDescription: nil) {
|
||||
menuItem.image = image
|
||||
}
|
||||
}
|
||||
navigateMenu.items.append(menuItem)
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
|
||||
+8
-5
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="24123.1" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="24127" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="24123.1"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="24127"/>
|
||||
<capability name="NSView safe area layout guides" minToolsVersion="12.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
@@ -297,17 +297,17 @@
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Navigate" autoenablesItems="NO" id="gGe-RP-Ys4">
|
||||
<items>
|
||||
<menuItem title="Back" keyEquivalent="[" id="4nC-yt-nEz">
|
||||
<menuItem title="Back" secondaryImage="NSGoBackTemplate" keyEquivalent="[" id="4nC-yt-nEz">
|
||||
<connections>
|
||||
<action selector="navigateBackBtnClicked:" target="XGW-R4-ybE" id="1Js-TT-NXZ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Reload Page" keyEquivalent="r" id="RZb-6e-dMo">
|
||||
<menuItem title="Reload Page" secondaryImage="NSRefreshTemplate" keyEquivalent="r" id="RZb-6e-dMo">
|
||||
<connections>
|
||||
<action selector="reloadPage:" target="XGW-R4-ybE" id="0AT-pi-VuZ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Search" keyEquivalent="f" id="JRN-bq-1gM">
|
||||
<menuItem title="Search" secondaryImage="magnifyingglass" catalog="system" keyEquivalent="f" id="JRN-bq-1gM">
|
||||
<connections>
|
||||
<action selector="selectText:" target="0L3-LH-chu" id="ykw-S6-5Kl"/>
|
||||
</connections>
|
||||
@@ -440,6 +440,9 @@
|
||||
<userDefaultsController representsSharedInstance="YES" id="Gxl-ZZ-6oq"/>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="NSGoBackTemplate" width="12" height="17"/>
|
||||
<image name="NSRefreshTemplate" width="18" height="21"/>
|
||||
<image name="NSTouchBarShareTemplate" width="19" height="23"/>
|
||||
<image name="magnifyingglass" catalog="system" width="16" height="15"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
Reference in New Issue
Block a user