Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new option screensaver_stop_close_browser_mod_popup #304

Merged
merged 1 commit into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ You can set the following configuration parameters for every individual Home Ass
| disable_screensaver_on_browser_mod_popup | Disable screensaver if a browser mod popup is active? | false |
| disable_screensaver_on_browser_mod_popup_func| Javascript function to determine whether to disable screensaver based on active browser mod popup ([see below](#disable_screensaver_on_browser_mod_popup_func)) | |
| screensaver_stop_navigation_path | Path to navigate to (e.g., /lovelace/default_view) when screensaver is stopped. | |
| screensaver_stop_close_browser_mod_popup | Close the active browser mod popup when screensaver is stopped? | false |
| screensaver_entity | An entity of type 'input_boolean' to reflect and change the screensaver state (on = started, off = stopped). If browser_mod is installed, `${browser_id}` will be replaced with Browser ID (see below). | |
| show_images | Show images if screensaver is active? | true |
| image_url | Fetch screensaver images from this URL. See below for details. | See below |
Expand Down
21 changes: 15 additions & 6 deletions wallpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const defaultConfig = {
black_screen_after_time: 0,
control_reactivation_time: 1.0,
screensaver_stop_navigation_path: '',
screensaver_stop_close_browser_mod_popup: false,
screensaver_entity: '',
stop_screensaver_on_mouse_move: true,
stop_screensaver_on_mouse_click: true,
Expand Down Expand Up @@ -2305,13 +2306,21 @@ class WallpanelView extends HuiView {

this.setScreensaverEntityState();

if (config.screensaver_stop_navigation_path) {
if (config.screensaver_stop_navigation_path || config.screensaver_stop_close_browser_mod_popup) {
this.screensaverStopNavigationPathTimeout = setTimeout(() => {
skipDisableScreensaverOnLocationChanged = true;
navigate(config.screensaver_stop_navigation_path);
setTimeout(() => {
skipDisableScreensaverOnLocationChanged = false;
}, 250);
if (config.screensaver_stop_navigation_path) {
skipDisableScreensaverOnLocationChanged = true;
navigate(config.screensaver_stop_navigation_path);
setTimeout(() => {
skipDisableScreensaverOnLocationChanged = false;
}, 250);
}
if (config.screensaver_stop_close_browser_mod_popup) {
let bmp = getActiveBrowserModPopup();
if (bmp) {
bmp.closeDialog();
}
}
}, (config.fade_in_time + 1) * 1000);
}
}
Expand Down
Loading