@@ -17,6 +17,7 @@ import {
1717 dialog ,
1818 globalShortcut ,
1919 ipcMain ,
20+ screen ,
2021 shell ,
2122} from 'electron' ;
2223import { autoUpdater } from 'electron-updater' ;
@@ -115,7 +116,7 @@ const createWindow = async () => {
115116 }
116117 } ) ;
117118
118- mainWindow . webContents . on ( 'before-input-event' , ( event , ipnut ) => {
119+ mainWindow . webContents . on ( 'before-input-event' , ( _event , ipnut ) => {
119120 if ( ipnut . key === 'Escape' ) {
120121 stopPrinting = true ;
121122 }
@@ -190,23 +191,25 @@ const createScreenWindow = (select: string) => {
190191 screenWindow = new BrowserWindow ( {
191192 frame : false ,
192193 transparent : true ,
194+ parent : mainWindow || undefined ,
195+ width : screen . getPrimaryDisplay ( ) . size . width ,
196+ height : screen . getPrimaryDisplay ( ) . size . height ,
193197 webPreferences : {
194198 nodeIntegration : true ,
195199 contextIsolation : false ,
196200 } ,
197- parent : mainWindow || undefined ,
198201 } ) ;
199202 }
200203 screenWindow . loadURL (
201204 `file://${ __dirname } /index.html?page=screen&select=${ select } `
202205 ) ;
203206
204207 screenWindow . webContents . on ( 'did-finish-load' , ( ) => {
205- screenWindow ?. maximize ( ) ;
206208 screenWindow ?. show ( ) ;
209+ screenWindow ?. webContents . send ( 'screen-show' ) ;
207210 } ) ;
208211
209- screenWindow . webContents . on ( 'before-input-event' , ( event , ipnut ) => {
212+ screenWindow . webContents . on ( 'before-input-event' , ( _event , ipnut ) => {
210213 if ( ipnut . key === 'Escape' ) {
211214 screenWindow ?. close ( ) ;
212215 }
@@ -234,6 +237,10 @@ ipcMain.handle('close-screen', (_, coord) => {
234237
235238ipcMain . handle ( 'start-printing' , ( _ , { frameCoord, nextCoord, pages } ) => {
236239 console . log ( 'Print with params' , frameCoord , nextCoord , pages ) ;
240+
241+ if ( stopPrinting ) {
242+ console . log ( 'Stop now' ) ;
243+ }
237244} ) ;
238245
239246/**
0 commit comments