summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/options.rst8
-rw-r--r--options/options.c6
-rw-r--r--player/playloop.c3
3 files changed, 12 insertions, 5 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 35f2b8862c..12496faca4 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -3255,10 +3255,12 @@ Window
1). A value of 1 means square pixels (correct for (almost?) all LCDs). See
also ``--monitoraspect`` and ``--video-aspect-override``.
-``--stop-screensaver``, ``--no-stop-screensaver``
+``--stop-screensaver=<yes|no|always>``
Turns off the screensaver (or screen blanker and similar mechanisms) at
- startup and turns it on again on exit (default: yes). The screensaver is
- always re-enabled when the player is paused.
+ startup and turns it on again on exit (default: yes). When using ``yes``,
+ the screensaver will re-enable when playback is not active. ``always`` will
+ always disable the screensaver. Note that stopping the screensaver is only
+ possible if a video output is available (i.e. there is an open mpv window).
This is not supported on all video outputs or platforms. Sometimes it is
implemented, but does not work (especially with Linux "desktops"). Read the
diff --git a/options/options.c b/options/options.c
index 1341cb891c..64d7f9146e 100644
--- a/options/options.c
+++ b/options/options.c
@@ -648,7 +648,11 @@ static const m_option_t mp_opts[] = {
{"cursor-autohide", OPT_CHOICE(cursor_autohide_delay,
{"no", -1}, {"always", -2}), M_RANGE(0, 30000)},
{"cursor-autohide-fs-only", OPT_FLAG(cursor_autohide_fs)},
- {"stop-screensaver", OPT_FLAG(stop_screensaver), .flags = UPDATE_SCREENSAVER},
+ {"stop-screensaver", OPT_CHOICE(stop_screensaver,
+ {"no", 0},
+ {"yes", 1},
+ {"always", 2}),
+ .flags = UPDATE_SCREENSAVER},
{"", OPT_SUBSTRUCT(video_equalizer, mp_csp_equalizer_conf)},
diff --git a/player/playloop.c b/player/playloop.c
index aea74d437c..093c135878 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -197,7 +197,8 @@ void update_screensaver_state(struct MPContext *mpctx)
if (!mpctx->video_out)
return;
- bool saver_state = !mpctx->playback_active || !mpctx->opts->stop_screensaver;
+ bool saver_state = (!mpctx->playback_active || !mpctx->opts->stop_screensaver) &&
+ mpctx->opts->stop_screensaver != 2;
vo_control_async(mpctx->video_out, saver_state ? VOCTRL_RESTORE_SCREENSAVER
: VOCTRL_KILL_SCREENSAVER, NULL);
}