Fix Minecraft window focus

This commit is contained in:
Albert Armea 2025-12-27 21:16:58 -05:00
parent 74e54a016c
commit ea15c978ba
2 changed files with 13 additions and 4 deletions

View file

@ -218,6 +218,11 @@ impl ManagedProcess {
}
}
// Java AWT/Swing applications (like Minecraft) need this to work properly
// on non-reparenting window managers like Sway. Without this, Java apps may
// have focus issues or render incorrectly.
cmd.env("_JAVA_AWT_WM_NONREPARENTING", "1");
// Special handling for WAYLAND_DISPLAY:
// If SHEPHERD_WAYLAND_DISPLAY is set, use that instead of the inherited value.
// This allows apps to be launched on a nested compositor while the daemon

View file

@ -58,10 +58,14 @@ for_window [app_id="shepherd-launcher"] fullscreen enable
for_window [class=".*"] fullscreen enable, border none, title_format ""
for_window [app_id=".*"] fullscreen enable, border none, title_format ""
# Minecraft-specific rules (XWayland Electron app)
for_window [class="Minecraft.*"] fullscreen enable, border none
for_window [class="minecraft-launcher"] fullscreen enable, border none
for_window [title="Minecraft.*"] fullscreen enable, border none
# Minecraft Launcher (Electron app) and Minecraft Java Edition (game)
# Launcher: class="Minecraft Launcher" instance="minecraft-launcher"
# Game: class="Minecraft 1.21.11" instance="Minecraft 1.21.11" (version varies)
# We add "focus" to ensure the window gets focus when it appears
for_window [class="^Minecraft [0-9]"] fullscreen enable, border none, focus
for_window [instance="^Minecraft [0-9]"] fullscreen enable, border none, focus
for_window [class="^Minecraft Launcher$"] fullscreen enable, border none
for_window [instance="^minecraft-launcher$"] fullscreen enable, border none
# Disable window decorations (no title bars) - for all windows
default_border none