-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8005f8b
commit 2c92ae4
Showing
7 changed files
with
72 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,49 @@ | ||
import { BrowserWindow, nativeImage } from 'electron/main'; | ||
import { resolve } from 'node:path'; | ||
|
||
/** | ||
* Define Window application component | ||
* @param {import('..').Context} context | ||
*/ | ||
export const Window = () => {}; | ||
export const Window = ({ app }) => { | ||
/** | ||
* Electron Browser window instance | ||
* @type {Electron.BrowserWindow|undefined} | ||
*/ | ||
let win = null; | ||
|
||
/** | ||
* Get window title | ||
* @type {string} | ||
* @private | ||
*/ | ||
const title = app.getName(); | ||
|
||
/** | ||
* Get window icon | ||
* @type {Electron.NativeImage} | ||
* @private | ||
*/ | ||
const icon = nativeImage.createFromPath( | ||
resolve('src', 'resources', 'icons', 'tray-icon.png') | ||
); | ||
|
||
/** | ||
* Create a new window instance | ||
*/ | ||
function render() { | ||
win = new BrowserWindow({ | ||
icon, | ||
title, | ||
width: 520, | ||
height: 400, | ||
webPreferences: { | ||
preload: resolve('src', 'main', 'preload.js'), | ||
}, | ||
}); | ||
|
||
win.loadFile(resolve('src', 'renderer', 'index.html')); | ||
} | ||
|
||
return { render, win }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.