Skip to content

Commit

Permalink
Prepare release (#18)
Browse files Browse the repository at this point in the history
- fix Releases path link in README
- add Windows web installer and portable targets
- Preserve window dimensions and position
  • Loading branch information
irahopkinson authored Feb 3, 2023
1 parent 5cc7421 commit 6a5017b
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To use `.AppImage` files in Linux, [install FUSE](https://github.com/AppImage/Ap
sudo apt install libfuse2
```

Then simply [execute/run](https://github.com/AppImage/AppImageKit/wiki) the `.AppImage` file, which you can download from [Releases](releases).
Then simply [execute/run](https://github.com/AppImage/AppImageKit/wiki) the `.AppImage` file, which you can download from [Releases](/paranext/paranext-core/releases).

## Developer Install

Expand Down
32 changes: 24 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"electron-debug": "^3.2.0",
"electron-log": "^4.4.8",
"electron-updater": "^5.2.3",
"electron-window-state": "^5.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.4.0"
Expand Down Expand Up @@ -224,7 +225,9 @@
},
"win": {
"target": [
"nsis"
"nsis",
"nsis-web",
"portable"
]
},
"linux": {
Expand Down
18 changes: 16 additions & 2 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import path from 'path';
import { app, BrowserWindow, shell, ipcMain } from 'electron';
import { autoUpdater } from 'electron-updater';
import log from 'electron-log';
import windowStateKeeper from 'electron-window-state';
import MenuBuilder from './menu';
import { resolveHtmlPath } from './util';

Expand Down Expand Up @@ -69,10 +70,18 @@ const createWindow = async () => {
return path.join(RESOURCES_PATH, ...paths);
};

// Load the previous state with fallback to defaults
const mainWindowState = windowStateKeeper({
defaultWidth: 1024,
defaultHeight: 728,
});

mainWindow = new BrowserWindow({
show: false,
width: 1024,
height: 728,
x: mainWindowState.x,
y: mainWindowState.y,
width: mainWindowState.width,
height: mainWindowState.height,
icon: getAssetPath('icon.png'),
webPreferences: {
preload: app.isPackaged
Expand All @@ -81,6 +90,11 @@ const createWindow = async () => {
},
});

// Register listeners on the window, so the state is updated automatically
// (the listeners will be removed when the window is closed)
// and restore the maximized or full screen state
mainWindowState.manage(mainWindow);

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

mainWindow.on('ready-to-show', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const root = createRoot(container);
root.render(<App />);

// calling IPC exposed from preload script
window.electron.ipcRenderer.once('ipc-example', (arg) => {
window.electron?.ipcRenderer.once('ipc-example', (arg) => {
// eslint-disable-next-line no-console
console.log(arg);
});
window.electron.ipcRenderer.sendMessage('ipc-example', ['ping']);
window.electron?.ipcRenderer.sendMessage('ipc-example', ['ping']);

0 comments on commit 6a5017b

Please sign in to comment.