From a88576e59a146f8bfcced04dbef5a0a8e89c955f Mon Sep 17 00:00:00 2001 From: Eva Ho Date: Fri, 7 Jul 2023 09:54:59 -0400 Subject: [PATCH] add Template to icon file name to handle bright and dark modes better on MacOS --- ...6x16.png => ollama_icon_16x16Template.png} | Bin ...x.png => ollama_icon_16x16Template@2x.png} | Bin app/assets/ollama_icon_dark_16x16.png | Bin 407 -> 0 bytes app/assets/ollama_icon_dark_16x16@2x.png | Bin 810 -> 0 bytes app/forge.config.ts | 4 ++-- app/src/index.ts | 18 +++++------------- 6 files changed, 7 insertions(+), 15 deletions(-) rename app/assets/{ollama_icon_birhgt_16x16.png => ollama_icon_16x16Template.png} (100%) rename app/assets/{ollama_icon_bright_16x16@2x.png => ollama_icon_16x16Template@2x.png} (100%) delete mode 100644 app/assets/ollama_icon_dark_16x16.png delete mode 100644 app/assets/ollama_icon_dark_16x16@2x.png diff --git a/app/assets/ollama_icon_birhgt_16x16.png b/app/assets/ollama_icon_16x16Template.png similarity index 100% rename from app/assets/ollama_icon_birhgt_16x16.png rename to app/assets/ollama_icon_16x16Template.png diff --git a/app/assets/ollama_icon_bright_16x16@2x.png b/app/assets/ollama_icon_16x16Template@2x.png similarity index 100% rename from app/assets/ollama_icon_bright_16x16@2x.png rename to app/assets/ollama_icon_16x16Template@2x.png diff --git a/app/assets/ollama_icon_dark_16x16.png b/app/assets/ollama_icon_dark_16x16.png deleted file mode 100644 index 804ead03a10f3bc866767628c277691dada49311..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 407 zcmV;I0cie-P)Jq{0=}e9w3;hyVKuToj{|$ABep>v+manU;0-@$O)co; zvADJpbYc^WxW|&Xv(Of_#iB3U=NXguwBK1A;R9=ULzlSQxR6MutUpc8-k6BH(sij` zU&&rj(?TAnxWo&VF^v(cv|!I^1%o&bTj4Q_K~#7F?Uu`L zO;Hrazc%8cP2Jm6NaJxO!i1`s0a0Oq34a1pqH`uXkcbH4k%j@c@dz41h>2&KASn@* z2o0qzns}rtK|;K`R@QfNcTUf_-RGV=?3etqpKI@Z*4}6B4NPc!<%J7EL1^^oKUX*| zoThCmWrTj=Ke_8+^V;d(Crm;LZRS8bg-+&MO7vgPKI*Ll%x^#nUFINpPOSNTCHl9s zPqVOq`C~|-N5Ti@Yf#*VT|zI4u6_vfmbQI&?7zWp+hV2r-{X|uIg^eESB2Zc52yZB z$o>gZE})P3Mo#(8^ zucy32I1dX}1-7kY-`$RVFxGTZ4^vOE9_$vW^k z*8SuHgDv|d+=F=|@RF*)v^~iJGEA?9>h%lPI(CycPQJBj%A-%Su_)zuMa+C-j3Dv`~ znxY!x&cG6;iB=t>;BQLwuF#jPzWt^my@KDmGl|g~;RPxu4Oq{k8sfGfE<%>8zp$s7 o_W}lBK_i3o(k+-Le2i)w1txv0?MN{~G5`Po07*qoM6N<$f(#IHCjbBd diff --git a/app/forge.config.ts b/app/forge.config.ts index b2b40324..420ecff0 100644 --- a/app/forge.config.ts +++ b/app/forge.config.ts @@ -19,8 +19,8 @@ const config: ForgeConfig = { icon: './assets/icon.icns', extraResource: [ '../ollama', - path.join(__dirname, './assets/ollama_icon_dark_16x16@2x.png'), - path.join(__dirname, './assets/ollama_icon_bright_16x16@2x.png'), + path.join(__dirname, './assets/ollama_icon_16x16Template.png'), + path.join(__dirname, './assets/ollama_icon_16x16Template@2x.png'), ...(process.platform === 'darwin' ? ['../ggml-metal.metal'] : []), ], ...(process.env.SIGN diff --git a/app/src/index.ts b/app/src/index.ts index 2a8cbe8a..268fed29 100644 --- a/app/src/index.ts +++ b/app/src/index.ts @@ -1,5 +1,5 @@ import { spawn, exec } from 'child_process' -import { app, autoUpdater, dialog, Tray, Menu, nativeTheme } from 'electron' +import { app, autoUpdater, dialog, Tray, Menu } from 'electron' import * as path from 'path' import * as fs from 'fs' @@ -15,22 +15,14 @@ if (!SingleInstanceLock) { } const createSystemtray = () => { - let brightModeIconPath = path.join(__dirname, '..', '..', 'assets', 'ollama_icon_dark_16x16.png') - let darkModeIconPath = path.join(__dirname, '..', '..', 'assets', 'ollama_icon_bright_16x16.png') + + let iconPath = path.join(__dirname, '..', '..', 'assets', 'ollama_icon_16x16Template.png') if (app.isPackaged) { - brightModeIconPath = path.join(process.resourcesPath, 'ollama_icon_dark_16x16@2x.png') - darkModeIconPath = path.join(process.resourcesPath, 'ollama_icon_bright_16x16@2x.png') + iconPath = path.join(process.resourcesPath, 'ollama_icon_16x16Template.png') } - tray = new Tray(brightModeIconPath) - - if (process.platform === 'darwin') { - tray.setImage(nativeTheme.shouldUseDarkColors ? darkModeIconPath : brightModeIconPath) - nativeTheme.on('updated', () => { - tray.setImage(nativeTheme.shouldUseDarkColors ? darkModeIconPath : brightModeIconPath) - }) - } + tray = new Tray(iconPath) const contextMenu = Menu.buildFromTemplate([{ role: 'quit', label: 'Quit Ollama', accelerator: 'Command+Q' }])