Hide HUD while a game window is fullscreen

A mapped LayerShell surface prevents KWin from using DRM direct
scanout for fullscreen windows. Setting showing=false fades out
the HUD then sets visible=false, unmapping the Wayland surface
and allowing KWin to bypass the compositor render loop entirely
for the game frame.

The HUD reappears when the game exits or is minimised. Error
toasts still work because a failed launch never produces a
fullscreen window, so showingWindow remains false.
This commit is contained in:
Marco Allegretti 2026-04-25 09:48:50 +02:00
parent 0ce8d6eb46
commit 69b8484025

View file

@ -758,11 +758,17 @@ ContainmentItem {
// the user return to the Game Center after launching a game.
// Keep the Loader active for the full duration of gaming mode so the
// opacity Behavior in GamingHUD can animate both fade-in and fade-out.
//
// Hide the HUD while a game window covers the screen. A mapped LayerShell
// surface prevents KWin from using DRM direct scanout for the fullscreen
// game window. Setting showing=false triggers the opacity fade-out and then
// sets visible=false, which unmaps the Wayland surface and lets KWin bypass
// the compositor render loop entirely for the game frame.
Loader {
active: ShellSettings.Settings.gamingModeEnabled
sourceComponent: GamingHUD {
visible: showing
showing: !root.gameCenterOpen
showing: !root.gameCenterOpen && !windowMaximizedTracker.showingWindow
onOpenRequested: root.gameCenterOpen = true
}
}