Avoid Xwayland scans on X11 sessions (#16232)

Desktop refresh runs repeatedly for active sessions, spawning 'psgrep'
procs and producing significant CPU load. Guard the Xwayland process
scan with the session protocol so X11 sessions skip work that cannot
contribute session information.

This preserves the existing Wayland discovery path while leaving X11
refresh behavior on its established display and xauth values.
This commit is contained in:
Vorschreibung
2026-09-16 14:24:50 +02:00
committed by GitHub
parent 092a961b62
commit 0ac2e7fb52

View File

@@ -2370,10 +2370,17 @@ mod desktop {
last
}
/// Preserves an active seat0 session's cached identity so the service loop only retries
/// late Wayland display discovery instead of repeating the full seat lookup.
pub fn refresh(&mut self) {
if !self.sid.is_empty() && is_active_and_seat0(&self.sid) {
// Xwayland display and xauth may not be available in a short time after login.
if is_xwayland_running(&self.uid) && !self.is_login_wayland() {
// Avoid scanning processes on X11, where Xwayland discovery cannot provide any
// useful session information.
if self.is_wayland()
&& !self.is_login_wayland()
&& is_xwayland_running(&self.uid)
{
self.get_display_xauth_xwayland();
} else if self.is_wayland() {
self.get_display_xauth_wayland();