-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
electron: Persist last window size and position between sessions
- Loading branch information
1 parent
10920ea
commit 9de661d
Showing
2 changed files
with
66 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import Store from 'electron-store' | ||
|
||
const electronStoreSchema = { | ||
windowBounds: { | ||
type: 'object', | ||
properties: { | ||
width: { | ||
type: 'number', | ||
}, | ||
height: { | ||
type: 'number', | ||
}, | ||
x: { | ||
type: 'number', | ||
}, | ||
y: { | ||
type: 'number', | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
/** | ||
* Electron store schema | ||
* Stores configuration data | ||
*/ | ||
export interface ElectronStoreSchema { | ||
/** | ||
* Window bounds | ||
*/ | ||
windowBounds: | ||
| undefined | ||
| { | ||
/** | ||
* Last known window width | ||
*/ | ||
width: number | ||
/** | ||
* Last known window height | ||
*/ | ||
height: number | ||
/** | ||
* Last known window x position | ||
*/ | ||
x: number | ||
/** | ||
* Last known window y position | ||
*/ | ||
y: number | ||
} | ||
} | ||
|
||
const store = new Store<ElectronStoreSchema>({ schema: electronStoreSchema }) | ||
|
||
export default store |