markpdfdown 0.1.7-beta.5 → 0.1.7-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main/index.js +22 -5
- package/package.json +1 -1
package/dist/main/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { app, ipcMain, dialog, protocol, BrowserWindow, shell } from "electron";
|
|
1
|
+
import { app, ipcMain, dialog, protocol, nativeImage, BrowserWindow, shell } from "electron";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import fs, { promises } from "fs";
|
|
4
4
|
import isDev from "electron-is-dev";
|
|
@@ -3483,6 +3483,19 @@ async function stopTask() {
|
|
|
3483
3483
|
function createWindow() {
|
|
3484
3484
|
const iconPath = getIconPath();
|
|
3485
3485
|
const iconExists = fs.existsSync(iconPath);
|
|
3486
|
+
let appIcon;
|
|
3487
|
+
if (iconExists) {
|
|
3488
|
+
try {
|
|
3489
|
+
appIcon = nativeImage.createFromPath(iconPath);
|
|
3490
|
+
if (appIcon.isEmpty()) {
|
|
3491
|
+
console.warn("[Main] Icon loaded but is empty:", iconPath);
|
|
3492
|
+
appIcon = void 0;
|
|
3493
|
+
}
|
|
3494
|
+
} catch (err) {
|
|
3495
|
+
console.warn("[Main] Failed to load icon:", iconPath, err);
|
|
3496
|
+
appIcon = void 0;
|
|
3497
|
+
}
|
|
3498
|
+
}
|
|
3486
3499
|
mainWindow = new BrowserWindow({
|
|
3487
3500
|
width: 1200,
|
|
3488
3501
|
height: 800,
|
|
@@ -3494,11 +3507,15 @@ function createWindow() {
|
|
|
3494
3507
|
contextIsolation: true,
|
|
3495
3508
|
preload: path.join(__dirname, "../preload/index.js")
|
|
3496
3509
|
},
|
|
3497
|
-
//
|
|
3498
|
-
...
|
|
3510
|
+
// 仅在图标成功加载时设置
|
|
3511
|
+
...appIcon ? { icon: appIcon } : {}
|
|
3499
3512
|
});
|
|
3500
|
-
if (process.platform === "darwin" && app.dock &&
|
|
3501
|
-
|
|
3513
|
+
if (process.platform === "darwin" && app.dock && appIcon) {
|
|
3514
|
+
try {
|
|
3515
|
+
app.dock.setIcon(appIcon);
|
|
3516
|
+
} catch (err) {
|
|
3517
|
+
console.warn("[Main] Failed to set dock icon:", err);
|
|
3518
|
+
}
|
|
3502
3519
|
}
|
|
3503
3520
|
windowManager.setMainWindow(mainWindow);
|
|
3504
3521
|
if (process.env.ELECTRON_RENDERER_URL) {
|
package/package.json
CHANGED