feat: Introduce scopebuddy - #2336
Conversation
This is a modified version of @coolavery's script from ValveSoftware/gamescope#835 (comment) It introduces the `goi` command which is a symlink to `gamescope-overlay-injector` that will do the whole unset LD_PRELOAD for gamescope and re-apply it for %command% song and dance. `goi` can replace `gamescope` in the launch options for games in steam with the only caveat that `%command%` has to be double quoted ex: `gamescope -w 1920 -h 1080 -W 2560 -H 1440 -r 180 --hdr-enabled -- %command% --nointro --etc` --> `goi -w 1920 -h 1080 -W 2560 -H 1440 -r 180 --hdr-enabled -- "%command%" --nointro --etc` Furthermore if the user has a config file `~/.config/gamescope-overlay-injector/goi.conf` and does not supply any args for gamescope, it will source this file before starting gamescope. This lets the user apply a default set of env vars and gamescope args that they use regularly for games to avoid messes like `env -u LD_PRELOAD ENABLE_GAMESCOPE_WSI=0 SteamDeck=0 XKB_DEFAULT_LAYOUT=no MANGOHUD_CONFIG=read_cfg,preset=2 gamescope -f -w 2560 -h 1440 -W 2560 -H 1440 -e --force-grab-cursor --hdr-enabled -- env LD_PRELOAD="$LD_PRELOAD" %command%` Instead they can define the defaults in `~/.config/gamescope-overlay-injector/goi.conf` like this ```ini export XKB_DEFAULT_LAYOUT=no export MANGOHUD_CONFIG=read_cfg,preset=2 GOI_DEFAULT_ARGS="--mangoapp -f -w 2560 -h 1440 -W 2560 -H 1440 -r 180 --force-grab-cursor --hdr-enabled -e --adaptive-sync" ``` now this is simplified in the launch options as `SteamDeck=0 ENABLE_GAMESCOPE_WSI=0 goi -- "%command%"` to not use the config the user just has to supply any gamescope arg like so `SteamDeck=0 ENABLE_GAMESCOPE_WSI=0 goi -r 180 -- "%command%"` RFC: * Unsure if we should make the script not load the config file at all if a gamescope arg is provided or if we should make it just load the env vars * Should we preemptively have this named something else in prep for upstream fixing this issue? PROS: * Fixes overlay when using nested gamescope in most titles * Gives users a command to use for using nested gamescope with a default set of env vars and args (giving this a purpose once it is fixed upstream) Limitations: * `%command%` has to be in double quotes, args after `"%command%"` does not need to be quoted unless you would normally * does not fix the overlay in all games, only most games * Works better if you enable "Use Big Picture overlay when using a controller" Co-authored-by: Avery <git@avery.cafe>
|
@wolfyreload and @Zeglius i would like some input from both of you on this one |
a299c02 to
ae4a36f
Compare
…ntil xwayland is initialized
Co-authored-by: Zeglius <33781398+Zeglius@users.noreply.github.com>
|
Suggested by Crono in discord:
|
according to @tulilirockz it will help making this work inside flatpak Co-authored-by: Tulip Blossom <tulilirockz@outlook.com>
e6ddf91 to
4bc7742
Compare
c8acf14 to
5d35911
Compare
|
next question would be, do we turn this into a package or something down the line 🤔 |
|
@HikariKnight I'm not using this as intended as I'm using it on bazzite-nvidia and it's pretty cool being able to just add |
true or even |
…ess to type for overriding and renamd SCB_CONFIG to SCB_CONFIGFILE for clairity in code
example: throw a config named `230410.conf` into `~/.config/scopebuddy/AppID/` and it will automatically be loaded instead of `scb.conf` as long as the user does not specify a custom file through the SCB_CONF env var
5b20efc to
178646f
Compare
@wolfyreload wanted to use this nonsense in gamemode :P
c250859 to
9c43500
Compare
9c43500 to
3883d09
Compare
|
Pretty sure this is feature complete now 😅 |
|
Commenting here to see in case someone has more information, but this seems to break menu use in things like Ryujinx (built with Avalonia). Even with the same exact arguments for gamescope — checked with I suspect something might be upsetting XWayland, but otherwise am, along with @HikariKnight (who's much smarter than me here), at a loss. Does anyone have a lead as to what would be different in the environment between the two — in a way that might be affecting gamescope's compositing? P.S.: Do note that I'm testing this script by placing it in |
at this point i am willing to chalk this up to some incompatibility with how the automatic LD_PRELOAD fix has to be applied, so far it seems either only flatpak applications are affected or only ryujinx, so either its a flatpak incompatibility or ryujinx incompatibility. Will be merging this into testing soon so that more people can play around with this. |
f01bba5 to
097e35a
Compare
Solved by 097e35a. |
Proper documentation has now been made! (this will always be up to date!)
Documentation: https://docs.bazzite.gg/Advanced/scopebuddy/
Old PR comment explaining usecase (this will not be updated!)
This is a modified version of @coolavery's script from ValveSoftware/gamescope#835 (comment)
It introduces the
scbcommand which is a symlink toscopebuddythat will do the whole unsetLD_PRELOADfor gamescope and re-apply it for%command%song and dance.scbcan replacegamescopein the launch options for games in steamex:
gamescope -w 1920 -h 1080 -W 2560 -H 1440 -r 180 --hdr-enabled -- %command% --nointro --etc-->scb -w 1920 -h 1080 -W 2560 -H 1440 -r 180 --hdr-enabled -- %command% --nointro --etcFurthermore if the user has a config file
~/.config/scopebuddy/scb.confit will be sourced before starting gamescope.If the above file exists and a config with the games AppID exists in
~/.config/scopebuddy/AppID/then that file will be loaded instead of thescb.confunless a custom one is set through the SCB_CONF env var.The file can set a
SCB_GAMESCOPE_ARGSvariable to providescbwith default gamescope arguments as long as the user givesscbno arguments before the--in the launch options, providing any args toscbwill make it ignoreSCB_GAMESCOPE_ARGScompletely and use whatever the user provides in the launch options.This lets the user apply a default set of env vars and gamescope args that they use regularly for games to avoid messes like
env -u LD_PRELOAD ENABLE_GAMESCOPE_WSI=0 SteamDeck=0 XKB_DEFAULT_LAYOUT=no MANGOHUD_CONFIG=read_cfg,preset=2 gamescope --mangoapp -f -w 2560 -h 1440 -W 2560 -H 1440 -e --force-grab-cursor --hdr-enabled -- env LD_PRELOAD="$LD_PRELOAD" %command%Instead they can define the defaults in
~/.config/scopebuddy/scb.conflike thisnow this is simplified in the launch options as
SteamDeck=0 ENABLE_GAMESCOPE_WSI=0 scb -- %command%If the user wants a specific config they do not need to remember for a specific game (in this example warframe) then they can make an AppID config in
~/.config/scopebuddy/AppID/230410.conf,230410is the Steam App ID for warframe. In this we can addSo now i can set the launch options for warframe to
scb -- %command%and it will source~/.config/scopebuddy/scb.confthen source~/.config/scopebuddy/AppID/230410.confwhich will override anything set byscb.confif they touch the same variables, in this example it will upscale the game from 1080p to 1440p and limit refresh rate to 60 while setting theSteamDeckandENABLE_GAMESCOPE_WSIenvironment variables, change MangoHud to preset 3 and keep the XDG keyboard layout set byscb.conf.This also means it will run any bash code written in the config file before launching the game too!
Then to not use the gamescope args defined in
SCB_GAMESCOPE_ARGSthe user just has to supply any gamescope arg like so, as they clearly do not want the defaults then. (current implementation still will apply default env vars though)scb -r 180 -- %command%The user can also define a different file that contains different defaults too by overriding
SCB_CONFwith the new filename.SCB_CONF=1080_180hz_upscaled_hdr.conf scb -- %command%this will then load the config from
~/.config/scopebuddy/1080_180hz_upscaled_hdr.confinsteadRFC:
Should we preemptively have this named something else in prep for upstream fixing this issue?PROS:
Limitations:
fixed with 58f5bf6%command%has to be in double quotes, args after"%command%"does not need to be quoted unless you would normallygamemode.confwill be forced as the only possible default config when running inside gamemode (appid configs will still be loaded as usual if they exist)