mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-30 18:05:55 +01:00 
			
		
		
		
	Save electron window size and position, closes #186
This commit is contained in:
		
							
								
								
									
										16
									
								
								electron.js
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								electron.js
									
									
									
									
									
								
							| @@ -7,6 +7,7 @@ const cls = require('./src/services/cls'); | ||||
| const url = require("url"); | ||||
| const port = require('./src/services/port'); | ||||
| const appIconService = require('./src/services/app_icon'); | ||||
| const windowStateKeeper = require('electron-window-state'); | ||||
|  | ||||
| const app = electron.app; | ||||
| const globalShortcut = electron.globalShortcut; | ||||
| @@ -28,14 +29,23 @@ function onClosed() { | ||||
| } | ||||
|  | ||||
| async function createMainWindow() { | ||||
|     let mainWindowState = windowStateKeeper({ | ||||
|         // default window width & height so it's usable on 1600 * 900 display (including some extra panels etc.) | ||||
|         defaultWidth: 1200, | ||||
|         defaultHeight: 800 | ||||
|     }); | ||||
|  | ||||
|     const win = new electron.BrowserWindow({ | ||||
|         // initial window width & height so it's usable on 1600 * 900 display (including some extra panels etc.) | ||||
|         width: 1200, | ||||
|         height: 800, | ||||
|         x: mainWindowState.x, | ||||
|         y: mainWindowState.y, | ||||
|         width: mainWindowState.width, | ||||
|         height: mainWindowState.height, | ||||
|         title: 'Trilium Notes', | ||||
|         icon: path.join(__dirname, 'src/public/images/app-icons/png/256x256.png') | ||||
|     }); | ||||
|  | ||||
|     mainWindowState.manage(win); | ||||
|  | ||||
|     win.setMenu(null); | ||||
|     win.loadURL('http://localhost:' + await port); | ||||
|     win.on('closed', onClosed); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user