"docs/git@developer.sourcefind.cn:OpenDAS/torchaudio.git" did not exist on "2ab49e5badb932c55c6f28a2b4b115a57050fa0e"
Commit a88576e5 authored by Eva Ho's avatar Eva Ho
Browse files

add Template to icon file name to handle bright and dark modes better on MacOS

parent 962cc9ca
...@@ -19,8 +19,8 @@ const config: ForgeConfig = { ...@@ -19,8 +19,8 @@ const config: ForgeConfig = {
icon: './assets/icon.icns', icon: './assets/icon.icns',
extraResource: [ extraResource: [
'../ollama', '../ollama',
path.join(__dirname, './assets/ollama_icon_dark_16x16@2x.png'), path.join(__dirname, './assets/ollama_icon_16x16Template.png'),
path.join(__dirname, './assets/ollama_icon_bright_16x16@2x.png'), path.join(__dirname, './assets/ollama_icon_16x16Template@2x.png'),
...(process.platform === 'darwin' ? ['../ggml-metal.metal'] : []), ...(process.platform === 'darwin' ? ['../ggml-metal.metal'] : []),
], ],
...(process.env.SIGN ...(process.env.SIGN
......
import { spawn, exec } from 'child_process' 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 path from 'path'
import * as fs from 'fs' import * as fs from 'fs'
...@@ -15,22 +15,14 @@ if (!SingleInstanceLock) { ...@@ -15,22 +15,14 @@ if (!SingleInstanceLock) {
} }
const createSystemtray = () => { 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) { if (app.isPackaged) {
brightModeIconPath = path.join(process.resourcesPath, 'ollama_icon_dark_16x16@2x.png') iconPath = path.join(process.resourcesPath, 'ollama_icon_16x16Template.png')
darkModeIconPath = path.join(process.resourcesPath, 'ollama_icon_bright_16x16@2x.png')
} }
tray = new Tray(brightModeIconPath) tray = new Tray(iconPath)
if (process.platform === 'darwin') {
tray.setImage(nativeTheme.shouldUseDarkColors ? darkModeIconPath : brightModeIconPath)
nativeTheme.on('updated', () => {
tray.setImage(nativeTheme.shouldUseDarkColors ? darkModeIconPath : brightModeIconPath)
})
}
const contextMenu = Menu.buildFromTemplate([{ role: 'quit', label: 'Quit Ollama', accelerator: 'Command+Q' }]) const contextMenu = Menu.buildFromTemplate([{ role: 'quit', label: 'Quit Ollama', accelerator: 'Command+Q' }])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment