feat: New Vesktop icon (#865)
changes the app icon and tray Co-authored-by: Wing <44992537+wingio@users.noreply.github.com> Co-authored-by: khcrysalis <sam4r16@gmail.com> Co-authored-by: Vendicated <vendicated@riseup.net>
This commit is contained in:
24
scripts/build/addAssetsCar.mjs
Normal file
24
scripts/build/addAssetsCar.mjs
Normal file
@@ -0,0 +1,24 @@
|
||||
import { copyFile, readdir } from "fs/promises";
|
||||
|
||||
/**
|
||||
* @param {{
|
||||
* readonly appOutDir: string;
|
||||
* readonly arch: Arch;
|
||||
* readonly electronPlatformName: string;
|
||||
* readonly outDir: string;
|
||||
* readonly packager: PlatformPackager;
|
||||
* readonly targets: Target[];
|
||||
* }} context
|
||||
*/
|
||||
export async function addAssetsCar({ appOutDir }) {
|
||||
if (process.platform !== "darwin") return;
|
||||
|
||||
const appName = (await readdir(appOutDir)).find(item => item.endsWith(".app"));
|
||||
|
||||
if (!appName) {
|
||||
console.warn(`Could not find .app directory in ${appOutDir}. Skipping adding assets.car`);
|
||||
return;
|
||||
}
|
||||
|
||||
await copyFile("build/Assets.car", `${appOutDir}/${appName}/Contents/Resources/Assets.car`);
|
||||
}
|
||||
5
scripts/build/afterPack.mjs
Normal file
5
scripts/build/afterPack.mjs
Normal file
@@ -0,0 +1,5 @@
|
||||
import { addAssetsCar } from "./addAssetsCar.mjs";
|
||||
|
||||
export default async function afterPack(context) {
|
||||
await addAssetsCar(context);
|
||||
}
|
||||
5
scripts/build/beforePack.mjs
Normal file
5
scripts/build/beforePack.mjs
Normal file
@@ -0,0 +1,5 @@
|
||||
import { applyAppImageSandboxFix } from "./sandboxFix.mjs";
|
||||
|
||||
export default async function beforePack() {
|
||||
await applyAppImageSandboxFix();
|
||||
}
|
||||
@@ -6,18 +6,21 @@
|
||||
|
||||
// Based on https://github.com/gergof/electron-builder-sandbox-fix/blob/master/lib/index.js
|
||||
|
||||
const fs = require("fs/promises");
|
||||
const path = require("path");
|
||||
import fs from "fs/promises";
|
||||
import path from "path";
|
||||
import AppImageTarget from "app-builder-lib/out/targets/AppImageTarget.js";
|
||||
|
||||
let isApplied = false;
|
||||
|
||||
const hook = async () => {
|
||||
if (isApplied) return;
|
||||
isApplied = true;
|
||||
export async function applyAppImageSandboxFix() {
|
||||
if (process.platform !== "linux") {
|
||||
// this fix is only required on linux
|
||||
return;
|
||||
}
|
||||
const AppImageTarget = require("app-builder-lib/out/targets/AppImageTarget");
|
||||
|
||||
if (isApplied) return;
|
||||
isApplied = true;
|
||||
|
||||
const oldBuildMethod = AppImageTarget.default.prototype.build;
|
||||
AppImageTarget.default.prototype.build = async function (...args) {
|
||||
console.log("Running AppImage builder hook", args);
|
||||
@@ -69,6 +72,4 @@ exec "$SCRIPT_DIR/${this.packager.executableName}.bin" "$([ "$IS_STEAMOS" == 1 ]
|
||||
|
||||
return ret;
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = hook;
|
||||
}
|
||||
Reference in New Issue
Block a user