mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +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); | ||||
|   | ||||
							
								
								
									
										11
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										11
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "trilium", | ||||
|   "version": "0.29.0-beta", | ||||
|   "version": "0.29.1", | ||||
|   "lockfileVersion": 1, | ||||
|   "requires": true, | ||||
|   "dependencies": { | ||||
| @@ -3107,6 +3107,15 @@ | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "electron-window-state": { | ||||
|       "version": "5.0.3", | ||||
|       "resolved": "https://registry.npmjs.org/electron-window-state/-/electron-window-state-5.0.3.tgz", | ||||
|       "integrity": "sha512-1mNTwCfkolXl3kMf50yW3vE2lZj0y92P/HYWFBrb+v2S/pCka5mdwN3cagKm458A7NjndSwijynXgcLWRodsVg==", | ||||
|       "requires": { | ||||
|         "jsonfile": "^4.0.0", | ||||
|         "mkdirp": "^0.5.1" | ||||
|       } | ||||
|     }, | ||||
|     "emitter-listener": { | ||||
|       "version": "1.1.2", | ||||
|       "resolved": "https://registry.npmjs.org/emitter-listener/-/emitter-listener-1.1.2.tgz", | ||||
|   | ||||
| @@ -32,6 +32,7 @@ | ||||
|     "electron-debug": "2.1.0", | ||||
|     "electron-dl": "1.13.0", | ||||
|     "electron-in-page-search": "1.3.2", | ||||
|     "electron-window-state": "^5.0.3", | ||||
|     "express": "4.16.4", | ||||
|     "express-session": "1.15.6", | ||||
|     "file-type": "10.7.1", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user