logind: tighten for which classes of sessions we do stop-on-idle

We only want to do this for fully set up, interactive sessions, i.e.
user and user-early, but not for any others, hence restrict the rules a
bit.

Follow-up for: 508b4786e8
This commit is contained in:
Lennart Poettering
2024-01-11 17:23:48 +01:00
parent d2a4c37972
commit ad23439eae
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -817,7 +817,7 @@ static int session_setup_stop_on_idle_timer(Session *s) {
assert(s);
if (s->manager->stop_idle_session_usec == USEC_INFINITY || IN_SET(s->class, SESSION_GREETER, SESSION_LOCK_SCREEN))
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(
+3
View File
@@ -54,6 +54,9 @@ typedef enum SessionClass {
/* Which sessions are candidates to become "display" sessions */
#define SESSION_CLASS_CAN_DISPLAY(class) (IN_SET((class), SESSION_USER, SESSION_USER_EARLY, SESSION_GREETER))
/* Which sessions classes should be subject to stop-in-idle */
#define SESSION_CLASS_CAN_STOP_ON_IDLE(class) (IN_SET((class), SESSION_USER, SESSION_USER_EARLY))
typedef enum SessionType {
SESSION_UNSPECIFIED,
SESSION_TTY,