add steam gamescope wrapper
This commit is contained in:
parent
4b58f34a20
commit
ec8ef7f024
1 changed files with 37 additions and 31 deletions
|
|
@ -1,24 +1,30 @@
|
|||
{ pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
steam = lib.getExe config.programs.steam.package;
|
||||
in
|
||||
{
|
||||
programs.steam = {
|
||||
enable = true;
|
||||
extraCompatPackages = [ pkgs.proton-ge-bin ];
|
||||
gamescopeSession.enable = true;
|
||||
};
|
||||
|
||||
# Wrap `steam` so everything (including the desktop files steam creates for games) launches inside gamescope
|
||||
environment.systemPackages = [
|
||||
(lib.hiPrio (
|
||||
pkgs.makeDesktopItem {
|
||||
name = "steam";
|
||||
desktopName = "Steam";
|
||||
exec = "steam-gamescope";
|
||||
icon = "steam";
|
||||
categories = [
|
||||
"Network"
|
||||
"FileTransfer"
|
||||
"Game"
|
||||
];
|
||||
}
|
||||
pkgs.writeShellScriptBin "steam" ''
|
||||
# If steam is already running, just hand the args (e.g. steam://rungameid/...) to it
|
||||
pid=$(cat "$HOME/.steam/steam.pid" 2>/dev/null)
|
||||
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then
|
||||
exec ${steam} "$@"
|
||||
fi
|
||||
|
||||
exec gamescope --steam -- ${steam} -tenfoot -pipewire-dmabuf "$@"
|
||||
''
|
||||
))
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue