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

(RHEL-19215) logind: don't setup idle session watch for lock-screen and greeter #441

Merged
merged 2 commits into from
Nov 6, 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
9 changes: 5 additions & 4 deletions man/logind.conf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,11 @@
<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></listitem>
</varlistentry>
Expand Down
2 changes: 1 addition & 1 deletion src/login/logind-session.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,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 || !SESSION_CLASS_CAN_STOP_ON_IDLE(s->class))
return 0;

r = sd_event_add_time_relative(
Expand Down
3 changes: 3 additions & 0 deletions src/login/logind-session.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ typedef enum SessionClass {
_SESSION_CLASS_INVALID = -1
} SessionClass;

/* Which sessions classes should be subject to stop-in-idle */
#define SESSION_CLASS_CAN_STOP_ON_IDLE(class) (IN_SET((class), SESSION_USER))

typedef enum SessionType {
SESSION_UNSPECIFIED,
SESSION_TTY,
Expand Down
Loading