desktop: use ico icons on windows

This commit is contained in:
Abdullah Atta
2023-01-26 14:55:58 +05:00
committed by Abdullah Atta
parent 45c6daabe7
commit b362dca795
10 changed files with 8 additions and 5 deletions

View File

@@ -21,6 +21,7 @@ import { nativeTheme } from "electron";
import path from "path";
import { isDevelopment } from "./utils";
type Icons = "note-add" | "notebook-add" | "reminder-add" | "quit";
const APP_DIR = isDevelopment()
? process.cwd()
: path.dirname(process.execPath);
@@ -30,13 +31,15 @@ export class AssetManager {
format?: "ico" | "png" | "icns";
}) {
const { size = 32, format } = options;
if (format === "ico") return path.join("assets", "icons", "app.ico");
if (format === "icns") return path.join("assets", "icons", "app.icns");
return path.join("assets", "icons", `${size}x${size}.png`);
}
static icon(name: "note-add" | "notebook-add" | "reminder-add" | "quit") {
static icon(name: Icons, format: "png" | "ico" = "png") {
const prefix = nativeTheme.shouldUseDarkColors ? ".dark" : "";
return path.join(APP_DIR, "assets", "icons", `${name}${prefix}.png`);
return path.join(APP_DIR, "assets", "icons", `${name}${prefix}.${format}`);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -34,7 +34,7 @@ function windows() {
items: [
{
program: process.execPath,
iconPath: AssetManager.icon("note-add"),
iconPath: AssetManager.icon("note-add", "ico"),
args: "new note",
description: "Create a new note",
title: "New note",
@@ -42,7 +42,7 @@ function windows() {
},
{
program: process.execPath,
iconPath: AssetManager.icon("notebook-add"),
iconPath: AssetManager.icon("notebook-add", "ico"),
args: "new notebook",
description: "Create a new notebook",
title: "New notebook",
@@ -50,7 +50,7 @@ function windows() {
},
{
program: process.execPath,
iconPath: AssetManager.icon("reminder-add"),
iconPath: AssetManager.icon("reminder-add", "ico"),
args: "new reminder",
description: "Add a new reminder",
title: "New reminder",