@@ -12,13 +12,13 @@ export default class Toaster {
12
12
const window = new BrowserWindow ( {
13
13
width : msg . width ,
14
14
height : 75 ,
15
- useContentSize : true ,
16
15
transparent : true ,
17
16
frame : false ,
18
17
show : false ,
19
18
alwaysOnTop : true ,
20
19
skipTaskbar : true ,
21
- resizeable : false
20
+ resizable : false ,
21
+ focusable : false
22
22
} ) ;
23
23
24
24
if ( this . debug ) {
@@ -38,8 +38,8 @@ export default class Toaster {
38
38
`title=${ encodeURIComponent ( msg . title || '' ) } &` +
39
39
`message=${ encodeURIComponent ( msg . message || '' ) } &` +
40
40
`timeout=${ msg . timeout } &` +
41
- `icon=${ msg . icon } &` +
42
- `tag=${ msg . tag } ` ;
41
+ `icon=${ encodeURIComponent ( msg . icon ) } &` +
42
+ `tag=${ encodeURIComponent ( msg . tag ) } ` ;
43
43
44
44
window . loadURL ( htmlFile ) ;
45
45
@@ -49,18 +49,18 @@ export default class Toaster {
49
49
}
50
50
51
51
_setPosition ( window , index ) {
52
- const width = window . getSize ( ) [ 0 ] ;
53
- const height = window . getSize ( ) [ 1 ] ;
54
- const pos = this . mainWindow . getPosition ( ) ;
55
- const display = screen . getDisplayNearestPoint ( { x : pos [ 0 ] , y : pos [ 1 ] } ) ;
56
- const notificationDistance = height + 5 ;
57
- const x = display . workAreaSize . width - width - 4 ;
58
- const y = display . workAreaSize . height - ( notificationDistance * index ) ;
52
+ const [ notificationWidth , notificationHeight ] = window . getSize ( ) ;
53
+ const [ appX , appY ] = this . mainWindow . getPosition ( ) ;
54
+ const { x , y , width , height } = screen . getDisplayNearestPoint ( { x : appX , y : appY } ) . workArea ;
55
+ const margin = 5 ;
56
+ const notificationX = x + width - notificationWidth - margin ;
57
+ const notificationDistance = notificationHeight + margin ;
58
+ const notificationY = y + height - ( notificationDistance * index ) ;
59
59
60
- window . setPosition ( x , y ) ;
60
+ window . setPosition ( notificationX , notificationY ) ;
61
61
62
62
if ( index <= this . maxNotifications ) {
63
- window . show ( ) ;
63
+ window . showInactive ( ) ;
64
64
}
65
65
}
66
66
}
0 commit comments