Skip to content

Commit 78a5c16

Browse files
committed
tweak icons
1 parent 94174a8 commit 78a5c16

12 files changed

Lines changed: 6 additions & 26 deletions

File tree

AppDelegate.swift

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -185,32 +185,12 @@ class AppDelegate: NSObject, NSApplicationDelegate {
185185
private func setupStatusBarIcon() {
186186
statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
187187
if let button = statusItem.button {
188-
if let originalImage = NSImage(named: "StatusIcon") {
189-
let targetSize = NSSize(width: 16, height: 16)
190-
let resizedImage = NSImage(size: targetSize)
191-
192-
resizedImage.lockFocus()
193-
let originalSize = originalImage.size
194-
let aspectRatio = originalSize.width / originalSize.height
195-
196-
var drawSize = targetSize
197-
if aspectRatio > 1 {
198-
drawSize.height = targetSize.width / aspectRatio
199-
} else {
200-
drawSize.width = targetSize.height * aspectRatio
201-
}
202-
203-
let drawRect = NSRect(
204-
x: (targetSize.width - drawSize.width) / 2,
205-
y: (targetSize.height - drawSize.height) / 2,
206-
width: drawSize.width,
207-
height: drawSize.height
208-
)
209-
210-
originalImage.draw(in: drawRect)
211-
resizedImage.unlockFocus()
212-
resizedImage.isTemplate = true
213-
button.image = resizedImage
188+
if let image = NSImage(named: "StatusIcon") {
189+
let height: CGFloat = 18
190+
let aspect = image.size.width / image.size.height
191+
image.size = NSSize(width: height * aspect, height: height)
192+
image.isTemplate = true
193+
button.image = image
214194
}
215195
button.toolTip = "MistTray"
216196

127 KB
Loading
11.5 KB
Loading
689 Bytes
Loading
27.2 KB
Loading
27.2 KB
Loading
1.46 KB
Loading
1.46 KB
Loading
57.9 KB
Loading
57.9 KB
Loading

0 commit comments

Comments
 (0)