feat: gamescope overlay window

This commit is contained in:
Samuel Maddock
2025-01-29 23:58:41 -05:00
parent 8543820d98
commit 9fe6d7d67e
2 changed files with 12 additions and 0 deletions

View File

@@ -121,6 +121,8 @@
tabbing identifier will be grouped together. This also adds a native new
tab button to your window's tab bar and allows your `app` and window to
receive the `new-window-for-tab` event.
* `gamescopeOverlay` boolean (optional) _Linux_ - Sets the window to appear
as an overlay for SteamOS's Gamescope compositor.
When setting minimum or maximum window size with `minWidth`/`maxWidth`/
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from

View File

@@ -360,6 +360,16 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
if (!window_type.empty())
SetWindowType(static_cast<x11::Window>(GetAcceleratedWidget()),
window_type);
// Allow window to overlay gamescope on SteamOS
bool gamescope_overlay = false;
if (options.Get("gamescopeOverlay", &gamescope_overlay) &&
gamescope_overlay) {
auto* connection = x11::Connection::Get();
connection->SetProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
x11::GetAtom("GAMESCOPE_EXTERNAL_OVERLAY"),
x11::Atom::CARDINAL, 1);
}
}
#endif