From 1bf9b8fa9c4bffa8dfa451c4a55850d7d7d64d9c Mon Sep 17 00:00:00 2001 From: Wojtek Mach Date: Wed, 15 Mar 2023 18:22:06 +0100 Subject: [PATCH] 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. --- rel/app/macos/Resources/MenuBarIcon.png | Bin 2342 -> 0 bytes rel/app/macos/Sources/Livebook/Livebook.swift | 7 ++++++- 2 files changed, 6 insertions(+), 1 deletion(-) delete mode 100644 rel/app/macos/Resources/MenuBarIcon.png diff --git a/rel/app/macos/Resources/MenuBarIcon.png b/rel/app/macos/Resources/MenuBarIcon.png deleted file mode 100644 index 866c9ce08940862a87d1a897296de61c67cfa139..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2342 zcmZ`)4Lp;19DjzyA}{SoxwDrzikL`U92qr1~pSIU(LmzQ+7kb8!3KHc;A{GZ?N`ToA&-^>5`KUCY)ZO?@mXt-`M&ODB7|uRXFb@+gh*YTnVl)AC1w1JS9xaFvN(j*;nDl#jZnQOKjQI(9~A`(Q3c@hcO z7TK0KQ{X??LVL4(22Uc2h*C}AC*(`Xc5{*?@KP0PAx_4B&@2X*3fLbLEC!bfe8NOh z5%^NYe6EL3$`gY_Nja)E=Ue=L#?oBd#e5$45@*yO_GB@(h_BjNf)78M7r~vp4?QtEOtt@INH6%dS%C*W_#SN?xyY7oP4U^rg_mfk zF+6jnFveJB z2!AtWd^7lI*PUF(opXx*vpum}_$EL1Ul`n(jk2lLFAd(9)HJRAostY+nNK2-#IJAM zYTuY1<$so^*J1i5j=r;nI8vRJA}o)%%JTS(y?dmwHDFiVZoIo2r)b@AW?_h~#kpOh zx#X%#(=CIC%p50HeD~~B=lwH&L0OlKu1BmkH8nM8EaCnW`Ae#!%V#`8e0BdodE z-qKRP@cNljcI8Op@e)m7x`c|P2glf>oQM_TV@JDP*{vgPy0sCa&EtJdkH!b~8Ri}M zS^HD%6Z!?KQ`{=TPr3CwH}?x-s?q{;qmPiQ-fexauz03xDIXXrOyK8g3PVC)4D1Q~ z6B>JKs;G>^hakMamFcN>E${HF{wLh=L}}$qxrSzj|9ay}+}EBLcY z=jwG2F01t&%z?*AuzvNmj3O`ewFe(e7<-Y4{3-aO(Tv+qcm{k96XSAC8@t zI(`xV1Ja@E(gba);Zpp`=0s$V!crE~wc#dHc*oit=7&htD9CS=V}Dh=rv`7n$AT3O zE-%t6-pEWtzC`4GnJ|^^mB@b-#U2QFcH_lR_xQ3me|PyEt%ouU(`Bz;xC;v=l!2E^VYQI?@J~)^Kf;clhY;#Bv)YVb%D!_ z6mD*>XsN!sW0X$!N9tFU1>DlxG_`EI3%hH@dm5xLt>{-?`Z<9LSGD`CMyA!Ig7oU6 z2q;DODlSMfXw~oNd@|rHtF$prfo6wj@>u`m+(m zG>uOvQK@ySyKAHaBK>jqgdfzqUYE7&$o>)}RK4E&>7Q*q$~LSuVzl%|*!N9uHT%S@ zaslq%NprYGLk#;oVsteP);;(gF3n}mXcxV*A5BRqupqK4yq#(pg2?TfNZGh=pn z)h+&SeXjN97VvnyYxb0j6_foirunLQjJ#%gZOzIFuJ#|O^QwP*4_9xhVr$S>{{lcx Bd|Chi diff --git a/rel/app/macos/Sources/Livebook/Livebook.swift b/rel/app/macos/Sources/Livebook/Livebook.swift index a2920ac0c..c33c4c747 100644 --- a/rel/app/macos/Sources/Livebook/Livebook.swift +++ b/rel/app/macos/Sources/Livebook/Livebook.swift @@ -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")