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

linux/win support #162

Merged
merged 4 commits into from
Aug 21, 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
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"postinstall": "ts-node scripts/scripts/check-native-dep.js && electron-builder install-app-deps && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./scripts/configs/webpack.config.renderer.dev.dll.ts",
"lint": "cross-env NODE_ENV=development eslint . --ext .js,.jsx,.ts,.tsx",
"package": "ts-node ./scripts/scripts/clean.js dist && npm run build && electron-builder build --publish never",
"package-mac": "ts-node ./scripts/scripts/clean.js dist && npm run build && electron-builder build --mac --publish never",
"package-lin": "ts-node ./scripts/scripts/clean.js dist && npm run build && electron-builder build --linux --publish never",
"package-win": "ts-node ./scripts/scripts/clean.js dist && npm run build && electron-builder build --win --x64 --publish never",
"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app",
"start": "ts-node ./scripts/scripts/check-port-in-use.js && npm run start:renderer",
"start:main": "cross-env NODE_ENV=development electronmon -r ts-node/register/transpile-only .",
Expand Down Expand Up @@ -141,9 +144,11 @@
"target": "default",
"arch": [
"arm64",
"'universal",
"x64"
]
},
"category": "public.app-category.developer-tools",
"type": "distribution",
"hardenedRuntime": true,
"entitlements": "assets/entitlements.mac.plist",
Expand All @@ -166,12 +171,18 @@
},
"win": {
"target": [
"nsis"
{
"target": "nsis",
"arch": ["x64", "arm64"]
}
]
},
"linux": {
"target": [
"AppImage"
{
"target": "AppImage",
"arch": ["x64", "arm64"]
}
],
"category": "Development"
},
Expand Down
10 changes: 6 additions & 4 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ const createWindow = async () => {

let { width, height } = screen.getPrimaryDisplay().workAreaSize;

const preload = app.isPackaged
? path.join(__dirname, 'preload.js')
: path.join(__dirname, '../../scripts/dll/preload.js');

mainWindow = new BrowserWindow({
show: false,
// frame: false,
Expand All @@ -186,16 +190,14 @@ const createWindow = async () => {
webPreferences: {
webviewTag: true,
nodeIntegration: true,
preload: app.isPackaged
? path.join(__dirname, 'preload.js')
: path.join(__dirname, '../../scripts/dll/preload.js'),
preload,
},
});

const nativeImage = require('electron').nativeImage;
const dockIcon = nativeImage.createFromPath(getAssetPath('icon.png'));

app.dock.setIcon(dockIcon); // todo: if electronStore preferences say to hide icon, hide icon with app.dock.setMenu(Menu.buildFromTemplate([])); maybe https://stackoverflow.com/questions/59668664/how-to-avoid-showing-a-dock-icon-while-my-electron-app-is-launching-on-macos
app.dock?.setIcon(dockIcon); // todo: if electronStore preferences say to hide icon, hide icon with app.dock.setMenu(Menu.buildFromTemplate([])); maybe https://stackoverflow.com/questions/59668664/how-to-avoid-showing-a-dock-icon-while-my-electron-app-is-launching-on-macos
app.name = 'God Mode';

mainWindow.loadURL(resolveHtmlPath('index.html'));
Expand Down