Skip to content

Commit

Permalink
Add option to not kill saver when DPMS kicks in
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentbernat committed Aug 14, 2022
1 parent 96780b9 commit f841a20
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@ Options to XSecureLock can be passed by environment variables:
* `XSECURELOCK_SAVER_DELAY_MS`: Milliseconds to wait after starting
children process and before mapping windows to let children be
ready to display and reduce the black flash.
* `XSECURELOCK_SAVER_STOP_ON_DPMS`: specifies if saver is stopped
when DPMS blanks the screen (to save power).
* `XSECURELOCK_XSCREENSAVER_PATH`: Location where XScreenSaver hacks are
installed for use by `saver_xscreensaver`.
Expand Down
6 changes: 5 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ int debug_window_info = 0;
int saver_reset_on_auth_close = 0;
//! Delay we should wait before starting mapping windows to let children run.
int saver_delay_ms = 0;
//! Whetever stopping saver when DPMS is running
int saver_stop_on_dpms = 0;

//! The PID of a currently running notify command, or 0 if none is running.
pid_t notify_command_pid = 0;
Expand Down Expand Up @@ -351,6 +353,7 @@ void LoadDefaults() {
saver_reset_on_auth_close =
GetIntSetting("XSECURELOCK_SAVER_RESET_ON_AUTH_CLOSE", 0);
saver_delay_ms = GetIntSetting("XSECURELOCK_SAVER_DELAY_MS", 0);
saver_stop_on_dpms = GetIntSetting("XSECURELOCK_SAVER_STOP_ON_DPMS", 1);
}

/*! \brief Parse the command line arguments, or exit in case of failure.
Expand Down Expand Up @@ -1077,7 +1080,8 @@ int main(int argc, char **argv) {
select(x11_fd + 1, &in_fds, 0, 0, &tv);

// Make sure to shut down the saver when blanked. Saves power.
enum WatchChildrenState requested_saver_state = IsBlankedByDPMS(display) ?
enum WatchChildrenState requested_saver_state =
(saver_stop_on_dpms && IsBlankedByDPMS(display)) ?
WATCH_CHILDREN_SAVER_DISABLED : xss_requested_saver_state;

// Now check status of our children.
Expand Down

0 comments on commit f841a20

Please sign in to comment.