Skip to content

Commit d023605

Browse files
committed
Add option to set app icon from node-launcher
1 parent ca97eac commit d023605

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

Tryouts/Prototypes/Shell/Node-launcher/Lib/src/Launcher.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,23 @@ export class Launcher {
55
private processArgs(config?: WindowConfig) {
66
let argsArray = [];
77
if (config) {
8+
if (config?.title) {
9+
argsArray.push(`--title=${config.title}`);
10+
}
11+
if(config?.icon) {
12+
argsArray.push(`--icon=${config.icon}`)
13+
}
814
if (config?.url) {
9-
argsArray.push(`--url=${config?.url}`);
15+
argsArray.push(`--url=${config.url}`);
1016
}
1117

1218
if (config?.width) {
13-
argsArray.push(`--width=${config?.width}`);
19+
argsArray.push(`--width=${config.width}`);
1420
}
1521

1622
if (config?.height) {
17-
argsArray.push(`--height=${config?.height}`);
18-
}
19-
if (config?.title) {
20-
argsArray.push(`--title=${config?.title}`);
21-
}
23+
argsArray.push(`--height=${config.height}`);
24+
}
2225
}
2326

2427
return argsArray;
@@ -27,15 +30,15 @@ export class Launcher {
2730
public launch(config?: WindowConfig) {
2831
let argsArray = this.processArgs(config);
2932

30-
if (argsArray.length === 0) {
31-
throw new Error("Specify at least one argument.");
32-
} else {
33+
if (!config?.url) {
34+
throw new Error("At least the url must be specified!");
35+
}
3336
const child = execFile("Shell.exe", argsArray, (error, stdout, stderr) => {
3437
console.log(stdout);
3538
if (error) {
3639
throw error;
3740
}
3841
});
39-
}
42+
4043
}
4144
}

Tryouts/Prototypes/Shell/Node-launcher/Lib/src/WindowConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export interface WindowConfig {
22
title?: string;
3+
icon?: string;
34
url?: string;
45
width?: number;
56
height?: number;

0 commit comments

Comments
 (0)