feat: new icon
@@ -54,6 +54,29 @@ function getStatusLabel() {
|
||||
return messages.trayServiceStopped;
|
||||
}
|
||||
|
||||
function getTrayIcon() {
|
||||
if (process.platform === 'darwin') {
|
||||
const iconPath16 = path.join(__dirname, '..', 'images', 'icons', 'icon@16px.png');
|
||||
const iconPath32 = path.join(__dirname, '..', 'images', 'icons', 'icon@32px.png');
|
||||
const icon = nativeImage.createFromPath(iconPath16);
|
||||
if (fsSync.existsSync(iconPath32)) {
|
||||
const icon2x = nativeImage.createFromPath(iconPath32);
|
||||
icon.addRepresentation({
|
||||
scaleFactor: 2,
|
||||
width: 32,
|
||||
height: 32,
|
||||
buffer: icon2x.toPNG()
|
||||
});
|
||||
}
|
||||
icon.setTemplateImage(true);
|
||||
return icon;
|
||||
}
|
||||
const scaleFactor = screen.getPrimaryDisplay().scaleFactor || 1;
|
||||
const size = scaleFactor >= 1.25 ? 32 : 16;
|
||||
const iconPath = path.join(__dirname, '..', 'images', 'icons', `icon@${size}px.png`);
|
||||
return nativeImage.createFromPath(iconPath);
|
||||
}
|
||||
|
||||
function updateTray() {
|
||||
if (!tray) return;
|
||||
updateTrayMenu({
|
||||
@@ -256,8 +279,7 @@ export async function startDesktop() {
|
||||
createSettingsWindow({ url: loadingUrl, preload: preloadPath, parent: mainWindow });
|
||||
mainWindow.once('ready-to-show', () => mainWindow.show());
|
||||
|
||||
const iconPath = path.join(__dirname, '..', 'images', 'icons', 'icon@16px.png');
|
||||
const trayIcon = nativeImage.createFromPath(iconPath);
|
||||
const trayIcon = getTrayIcon();
|
||||
tray = createTray({
|
||||
icon: trayIcon,
|
||||
tooltip: messages.appName,
|
||||
|
||||
BIN
images/icon.png
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 53 KiB |
50
images/icon.svg
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="512"
|
||||
height="512"
|
||||
viewBox="0 0 512 512"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
xml:space="preserve"
|
||||
inkscape:version="1.4.3 (0d15f75, 2025-12-25)"
|
||||
sodipodi:docname="icon.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="px"
|
||||
inkscape:zoom="1.2125776"
|
||||
inkscape:cx="256.06609"
|
||||
inkscape:cy="256.47843"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1027"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="25"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" /><defs
|
||||
id="defs1" /><g
|
||||
inkscape:label="图层 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"><text
|
||||
xml:space="preserve"
|
||||
style="font-size:374.772px;text-align:center;letter-spacing:-57.2531px;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;stroke-width:1.69325"
|
||||
x="245.0603"
|
||||
y="381.00632"
|
||||
id="text1"
|
||||
transform="scale(0.97940478,1.0210283)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1"
|
||||
x="216.43375"
|
||||
y="381.00632"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:374.772px;font-family:'Comic Sans MS';-inkscape-font-specification:'Comic Sans MS';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;letter-spacing:-57.2531px;stroke-width:1.69325"
|
||||
dx="0">MT</tspan></text></g></svg>
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 413 B |
|
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 250 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 755 B After Width: | Height: | Size: 596 B |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 791 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
images/lines.png
|
Before Width: | Height: | Size: 59 KiB |
@@ -76,7 +76,7 @@ async function repackAsar(unpackedDir: string) {
|
||||
if (fs.existsSync(asarUnpackDir)) {
|
||||
fs.rmSync(asarUnpackDir, { recursive: true })
|
||||
}
|
||||
await run('npx', ['@electron/asar', 'pack', appDir, asarFile])
|
||||
await run('npx', ['--yes', '@electron/asar', 'pack', appDir, asarFile])
|
||||
fs.rmSync(appDir, { recursive: true })
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 53 KiB |