Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to set app icon from node-launcher #163

Merged
merged 1 commit into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions Tryouts/Prototypes/Shell/Node-launcher/Lib/src/Launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@ export class Launcher {
private processArgs(config?: WindowConfig) {
let argsArray = [];
if (config) {
if (config?.title) {
argsArray.push(`--title=${config.title}`);
}
if(config?.icon) {
argsArray.push(`--icon=${config.icon}`)
}
if (config?.url) {
argsArray.push(`--url=${config?.url}`);
argsArray.push(`--url=${config.url}`);
}

if (config?.width) {
argsArray.push(`--width=${config?.width}`);
argsArray.push(`--width=${config.width}`);
}

if (config?.height) {
argsArray.push(`--height=${config?.height}`);
}
if (config?.title) {
argsArray.push(`--title=${config?.title}`);
}
argsArray.push(`--height=${config.height}`);
}
}

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

if (argsArray.length === 0) {
throw new Error("Specify at least one argument.");
} else {
if (!config?.url) {
throw new Error("At least the url must be specified!");
}
const child = execFile("Shell.exe", argsArray, (error, stdout, stderr) => {
console.log(stdout);
if (error) {
throw error;
}
});
}

}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export interface WindowConfig {
title?: string;
icon?: string;
url?: string;
width?: number;
height?: number;
Expand Down