Use high-resolution menu bar icon on Mac (#1795)

MenuBarIcon.png was pretty low resolution. Let's use an existing
high-resolution icon and scale it on demand.

Note we couldn't just use the LivebookIcon.icns directly because the
system seems to pick the largest size and the icon doesn't fit.
This commit is contained in:
Wojtek Mach 2023-03-15 18:22:06 +01:00 committed by GitHub
parent fb9c8df7ea
commit 1bf9b8fa9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -53,7 +53,12 @@ class AppDelegate: NSObject, NSApplicationDelegate {
statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
let button = statusItem.button!
button.image = NSImage(named: "MenuBarIcon")
let icon = NSImage(named: "LivebookIcon")!
let resizedIcon = NSImage(size: NSSize(width: 18, height: 18), flipped: false) { (dstRect) -> Bool in
icon.draw(in: dstRect)
return true
}
button.image = resizedIcon
let menu = NSMenu()
let copyURLItem = NSMenuItem(title: "Copy URL", action: nil, keyEquivalent: "c")