@@ -107,7 +107,7 @@ class ScreenWakeLock {
107
107
}
108
108
}
109
109
110
- const version = "4.28 .0" ;
110
+ const version = "4.29 .0" ;
111
111
const defaultConfig = {
112
112
enabled : false ,
113
113
enabled_on_tabs : [ ] ,
@@ -131,6 +131,7 @@ const defaultConfig = {
131
131
stop_screensaver_on_mouse_click : true ,
132
132
stop_screensaver_on_key_down : true ,
133
133
stop_screensaver_on_location_change : true ,
134
+ disable_screensaver_on_browser_mod_popup : false ,
134
135
show_images : true ,
135
136
image_url : "https://picsum.photos/${width}/${height}?random=${timestamp}" ,
136
137
immich_api_key : "" ,
@@ -225,6 +226,17 @@ if (window.browser_mod) {
225
226
}
226
227
}
227
228
229
+ function getActiveBrowserModPopup ( ) {
230
+ if ( ! browserId ) {
231
+ return null ;
232
+ }
233
+ const bmp = document . getElementsByTagName ( "browser-mod-popup" ) ;
234
+ if ( ! bmp || ! bmp [ 0 ] || ! bmp [ 0 ] . shadowRoot || bmp [ 0 ] . shadowRoot . children . length == 0 ) {
235
+ return null ;
236
+ }
237
+ return bmp [ 0 ] ;
238
+ }
239
+
228
240
function isObject ( item ) {
229
241
return ( item && typeof item === 'object' && ! Array . isArray ( item ) ) ;
230
242
}
@@ -449,6 +461,9 @@ function isActive() {
449
461
if ( config . enabled_on_tabs && config . enabled_on_tabs . length > 0 && activeTab && ! config . enabled_on_tabs . includes ( activeTab ) ) {
450
462
return false ;
451
463
}
464
+ if ( config . disable_screensaver_on_browser_mod_popup && getActiveBrowserModPopup ( ) ) {
465
+ return false ;
466
+ }
452
467
return true ;
453
468
}
454
469
@@ -778,9 +793,14 @@ class WallpanelView extends HuiView {
778
793
return ;
779
794
}
780
795
if ( this . screensaverRunning ( ) ) {
781
- this . updateScreensaver ( ) ;
796
+ if ( config . disable_screensaver_on_browser_mod_popup && getActiveBrowserModPopup ( ) ) {
797
+ this . stopScreensaver ( ) ;
798
+ }
799
+ else {
800
+ this . updateScreensaver ( ) ;
801
+ }
782
802
}
783
- else {
803
+ else if ( isActive ( ) ) {
784
804
if ( config . idle_time > 0 && Date . now ( ) - this . idleSince >= config . idle_time * 1000 ) {
785
805
this . startScreensaver ( ) ;
786
806
}
@@ -2474,13 +2494,13 @@ class WallpanelView extends HuiView {
2474
2494
return ;
2475
2495
}
2476
2496
2477
- const bmp = document . getElementsByTagName ( "browser-mod-popup" ) ;
2478
- if ( bmp && bmp [ 0 ] && bmp [ 0 ] . shadowRoot ) {
2479
- const bm_elements = [ bmp [ 0 ] . shadowRoot . querySelector ( ".content" ) , bmp [ 0 ] . shadowRoot . querySelector ( "ha-dialog-header" ) ] ;
2497
+ const bmp = getActiveBrowserModPopup ( ) ;
2498
+ if ( bmp ) {
2499
+ const bm_elements = [ bmp . shadowRoot . querySelector ( ".content" ) , bmp . shadowRoot . querySelector ( "ha-dialog-header" ) ] ;
2480
2500
for ( let i = 0 ; i < bm_elements . length ; i ++ ) {
2481
2501
if ( bm_elements [ i ] ) {
2482
2502
const pos = bm_elements [ i ] . getBoundingClientRect ( ) ;
2483
- logger . debug ( "Event position:" , elements [ i ] , x , y , pos . left , pos . right , pos . top , pos . bottom ) ;
2503
+ logger . debug ( "Event position:" , bm_elements [ i ] , x , y , pos . left , pos . right , pos . top , pos . bottom ) ;
2484
2504
if ( x >= pos . left && x <= pos . right && y >= pos . top && y <= pos . bottom ) {
2485
2505
logger . debug ( "Event on browser mod popup:" , bm_elements [ i ] ) ;
2486
2506
return ;
0 commit comments