ValveSoftware / steam-runtime

A runtime environment for Steam applications
Other
1.19k stars 86 forks source link

Cursor themes missing on non-native games in NixOS. #572

Closed YellowOnion closed 1 year ago

YellowOnion commented 1 year ago

Your system information

Please describe your issue in as much detail as possible:

inside my shell:

XCURSOR_PATH=/home/daniel/.icons:/home/daniel/.local/share/icons:/home/daniel/.nix-profile/share/icons:/home/daniel/.nix-profile/share/pixmaps:/etc/profiles/per-user/daniel/share/icons:/etc/profiles/per-user/daniel/share/pixmaps:/nix/var/nix/profiles/default/share/icons:/nix/var/nix/profiles/default/share/pixmaps:/run/current-system/sw/share/icons:/run/current-system/sw/share/pixmaps

while inside pressure-vessel (PRESSURE_VESSEL_SHELL=instead - can I use a custom terminal for this?):

XCURSOR_PATH=/run/host/user-share/icons:/run/host/share/icons

This looks like an issue for custom cursors in ~/.icons etc, both these folders have only what looks like two default cursor themes, Adwata should be i installed system wide tho, and doesn't appear, so might be an issue with the NixOS wrapper.

RyuzakiKK commented 1 year ago

This looks like an issue for custom cursors in ~/.icons etc

If XCURSOR_PATH is unset on the host system, inside the container XCURSOR_PATH will be set to match the default fallback behavior of libXcursor https://gitlab.freedesktop.org/xorg/lib/libxcursor/-/blob/80192583/src/library.c#L32

If instead you have a custom XCURSOR_PATH in your host system, inside the container its value will be set to just the two /run/host/user-share/icons:/run/host/share/icons

This could probably be improved by keeping/converting the XCURSOR_PATH values from the host system, and bind mounting them inside the container.

both these folders have only what looks like two default cursor themes, Adwata should be i installed system wide tho, and doesn't appear, so might be an issue with the NixOS wrapper.

This is similar to what Flatpak does. /run/host/share/icons is /usr/share/icons from the host system and /run/host/user-share/icons is $XDG_DATA_HOME/icons

YellowOnion commented 1 year ago

If I move my user cursors from ~/.icons/ to ~/.local/share/icons they start to appear in /run/host/, still can't see my system wide cursor, and it looks like FHSEnv doesn't have the Adwaita folder, but /run/current-system/sw/share/icons is accessible, and set via XCURSOR_PATH, and I can confirm that value is set, as it works from native linux games like Factorio.

This could probably be improved by keeping/converting the XCURSOR_PATH values from the host system, and bind mounting them inside the container.

Something akin to this seems to me the correct solution, it looks like PV currently merges all directories, so ~./local/share/icons and the steam runtime icons are inside /run/host/share/icons, but something is breaking in the way it bindmounts, since this PR does seem to do something with XCURSOR_PATH: https://github.com/Sonicadvance1/steam-runtime-tools/commit/5ed2b67c636aea7bd86bc431ea612fc29429600b.

Funny thing is, there's a line of code that's set when XCURSOR_PATH is unset:

      pv_search_path_append (new_xcursor_path, "~/.icons");

But ~/.local/share/icons isn't set, so it must be pull some info out of XCURSOR_PATH, just not all of it.

both user icons, just folders, nothing fancy, but /run/current-system/ is a bunch of symlinks so maybe something is breaking.

YellowOnion commented 1 year ago

hold up, looking at the code of pv_wrap_set_icons_env_vars(), the variable original_xcursor_path is not used to set XCURSOR_PATH in the pv environment, no wonder it doesn't work...

Here's a patch: https://github.com/YellowOnion/steam-runtime-tools/commits/main

RyuzakiKK commented 1 year ago

As I briefly mentioned before, the current logic is:

Here's a patch: https://github.com/YellowOnion/steam-runtime-tools/commits/main

Given the nature of the container setup, this could have some unexpected implications. For example let's assume that you have set XCURSOR_PATH to /var/opt/my_cursors:/usr/local/my_other_cursors:/home/user/.icons. In this scenario, if we simply append XCURSOR_PATH from the host system, the first two directories will be not accessible. That's because we don't bind-mount them in the same path, or at all, and only the last /home path will work as expected.

This is what we do for XDG_DATA_DIRS (used only to grab the icons from the host system), so probably we could implement that for XCURSOR_PATH too. Even if it's not ideal, it could still be better than what we have right now.

YellowOnion commented 1 year ago

I thought there might be issues here, but the logic doesn't make sense, we don't use the contents of XCURSOR_PATH, so why do we then decide how to set it inside the container based on if it's set or not, We shouldn't be checking if it's NULL we should just always set the hard coded defaults, that's why ~/.icons/ is ignored.

RyuzakiKK commented 1 year ago

A fix to keep the XCURSOR_PATH values from the host has been merged and will be included in the next Steam Linux Runtime Soldier release.

smcv commented 1 year ago

This is now in the client_beta branch. To have this fixed, you want to see pressure-vessel 0.20230314.0 or later in SteamLinuxRuntime_soldier/VERSIONS.txt.

kisak-valve commented 1 year ago

Closing as fixed.

smcv commented 1 year ago

This change progressed from beta to the default branch a while ago.

dnkmmr69420 commented 1 year ago

How can I fix this is my question?

smcv commented 1 year ago

How can I fix this is my question?

The issue described here is (believed to be) fixed. If you have encountered similar symptoms, please open a new issue with full details.