]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind: don't setup idle session watch for lock-screen and greeter
authorMichal Sekletar <msekleta@redhat.com>
Tue, 12 Dec 2023 18:03:39 +0000 (19:03 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 3 Jan 2024 20:27:41 +0000 (05:27 +0900)
Reason to skip the idle session logic for these session classes is that
they are idle by default.

man/logind.conf.xml
src/login/logind-session.c

index ff19ba91fa01b7af3468f6b35d39b988d085050e..d74c9b410fd3973aa4911780cd534b79ac1afcfc 100644 (file)
         <term><varname>StopIdleSessionSec=</varname></term>
 
         <listitem><para>Specifies a timeout in seconds, or a time span value after which
-        <filename>systemd-logind</filename> checks the idle state of all sessions. Every session that is idle for
-        longer then the timeout will be stopped. Defaults to <literal>infinity</literal>
-        (<filename>systemd-logind</filename> is not checking the idle state of sessions). For details about the syntax
-        of time spans, see
+        <filename>systemd-logind</filename> checks the idle state of all sessions. Every session that is idle
+        for longer than the timeout will be stopped. Note that this option doesn't apply to
+        <literal>greeter</literal> or <literal>lock-screen</literal> sessions. Defaults to
+        <literal>infinity</literal> (<filename>systemd-logind</filename> is not checking the idle state
+        of sessions). For details about the syntax of time spans, see
         <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
         </para>
 
index 03e5d68bdfc11f3963d57b324f55d2fab7e02194..b4277c33f1489d1f2c826bb4909bfc59baadcc53 100644 (file)
@@ -738,7 +738,7 @@ static int session_setup_stop_on_idle_timer(Session *s) {
 
         assert(s);
 
-        if (s->manager->stop_idle_session_usec == USEC_INFINITY)
+        if (s->manager->stop_idle_session_usec == USEC_INFINITY || IN_SET(s->class, SESSION_GREETER, SESSION_LOCK_SCREEN))
                 return 0;
 
         r = sd_event_add_time_relative(