[raiguard][1.1.107][Linux] Tiny Cursor through Wayland

This subforum contains all the issues which we already resolved.
brothersw
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Apr 27, 2024 12:42 am
Contact:

[raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by brothersw »

I just transitioned to NixOS and have been setting everything up. In Wayland mode (which is much appreciated due to 1.5x scaling for most apps), my cursor appears tiny when in the game. This is on a 28" 4K monitor and so I think that this may be causing the issue when in Wayland mode.

xrandr output for the screen Factorio is on:
DP-2 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 610mm x 350mm

Image of behavior:
factorioCursor.jpg
factorioCursor.jpg (792.51 KiB) Viewed 2532 times
Expected behavior demonstrated when another application is active over it:
expectedCursor.jpg
expectedCursor.jpg (687.97 KiB) Viewed 2532 times
Thank you for all that you do!
Attachments
factorio-current.log
(4.58 KiB) Downloaded 50 times
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 655
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by raiguard »

SDL2 has some issues with cursor themes that are beyond my power to fix. SDL3 will fix these issues.
Don't forget, you're here forever.
GlassBricks
Inserter
Inserter
Posts: 41
Joined: Fri Jun 11, 2021 5:20 pm
Contact:

Re: [raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by GlassBricks »

According to https://github.com/libsdl-org/SDL/issues/9250, SDL2 seems to have been fixed this on their end, but Factorio needs to update.

So... can we has not tiny cursor on wayland please?
Okabintaro
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Nov 01, 2024 5:51 pm
Contact:

Re: [raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by Okabintaro »

Heya, the issue is still present on the latest version (2.0.13, with Space Age Expansion at the time of writing).

But it's pretty easy to workaround by setting the XCURSOR_THEME and XCURSOR_SIZE environment variables.
For example on Plasma 6 on Arch I use these launch options on steam to get my cursor size to align with the system:

Code: Select all

XCURSOR_THEME=Breeze_Light XCURSOR_SIZE=48 %command%
More details about cursor themes can be found on the arch wiki here: https://wiki.archlinux.org/title/Cursor ... t_variable
I found my cursor themes at /usr/share/icons/Breeze_Light/cursors/.
Numerfolt
Manual Inserter
Manual Inserter
Posts: 1
Joined: Thu Nov 07, 2024 2:44 pm
Contact:

Re: [raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by Numerfolt »

This worked for me too:
Okabintaro wrote: Fri Nov 01, 2024 5:56 pm

Code: Select all

XCURSOR_THEME=Breeze_Light XCURSOR_SIZE=48 %command%
Two additions:
Using Plasma 6, you can find the theme name and cursor-size in the systemsettings too:
System Settings -> Color & Design -> Cursor

When I set my cursor size to default size * monitor scale (24 * 150% = 36), the cursor was too large.
For me it worked to just use the same cursor size as specified in the system settings.
Last edited by Numerfolt on Thu Nov 07, 2024 3:02 pm, edited 1 time in total.
Donion
Factorio Staff
Factorio Staff
Posts: 338
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by Donion »

I got curious and tried building with DBUS support (also the SDL has been updated to 2.30.9 in 2.0.16) as mentioned in the linked github issue and the cursor was still tiny on Wayland with 150% scaling. So either I've built it wrong or something else is missing.
tgurr
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Nov 18, 2024 10:28 am
Contact:

Re: [raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by tgurr »

Donion wrote: Tue Nov 12, 2024 9:49 pm I got curious and tried building with DBUS support (also the SDL has been updated to 2.30.9 in 2.0.16) as mentioned in the linked github issue and the cursor was still tiny on Wayland with 150% scaling. So either I've built it wrong or something else is missing.
Just curious as I started playing Factorio again yesterday and in the meantime also moved on to wayland and got bitten by this issue. When testing two questions arose for me after reading the GitHub SDL issue (https://github.com/libsdl-org/SDL/issues/9250).

* Have you been on KDE Plasma 6? Or GNOME?
* Did you have xdg-desktop-portal-gtk installed?

I'm not entirely sure if I get things right myself in regards to the prerequisits but judging from the initial PR https://github.com/libsdl-org/SDL/pull/9258 it states
GitHub wrote:Add support for the cursor shape protocol so that KDE will display the correct cursors, even if the settings portal is absent or SDL is built without dbus support.
and the relevant commit has been backported to SDL2 with https://github.com/libsdl-org/SDL/commi ... db8020b87c

which contradicts in parts to the initial statement from the GitHub issue which mentions the DBUS support as a requirement but to me this now reads as only still required when running GNOME, or at least not KDE Plasma:
GitHub wrote:The cursor shape protocol support has been backported to SDL2, so we've done everything we can do here. Note that this will fix it on KDE 6, but GNOME doesn't support this protocol yet, and if the Factorio devs continue to build their static library without dbus support, the GNOME settings where the theme and cursor size are stored can't be read, so the cursor will be the wrong size there.
so if I conclude things right at least on KDE Plasma 6 with a version released >1 year (as the MR for implementing the cursor-shape-v1 appears to be https://invent.kde.org/plasma/kwin/-/me ... uests/4060) things should work out of the box due to the cursor-shape-v1 protocol without any need for a working/installed portal AND without the DBUS requirement.

But for me it doesn't on latest KDE Plasma 6 (at the moment for writing this version 6.2.3) which renders me quite clueless after reading all that stuff what the issue could be and where to report it to hopefully get it addressed in the future, here, SDL, kwin?
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 655
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by raiguard »

I haven't looked at this thread since my first reply; I was unaware of the SDL github issue regarding this.

I changed our build system to build SDL with dbus support and that fixes the issue on GNOME. However, the latest version of SDL2 appears to be missing all of the cursor-shape-v1 code, so cursors will continue to be incorrect on Plasma. I am reaching out to the SDL devs about this.
Don't forget, you're here forever.
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 655
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by raiguard »

According to an SDL developer, cursor-shape-v1 wasn't included in SDL2 stable because it's a large change for a relatively minor bug. So users on Plasma will continue needing to use XCURSOR_THEME to work around this issue.
Don't forget, you're here forever.
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 655
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by raiguard »

Thanks for the report, this has been fixed for the next release... at least on GNOME. Plasma users will need to continue using the XCURSOR_THEME workaround.
Don't forget, you're here forever.
Zarko
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Dec 09, 2024 8:29 pm
Contact:

Re: [raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by Zarko »

@brothersw or anyone else that might be running NixOS. Have you found a way to use XCURSOR_THEME workaround actually work on Nix?

I tried several permutations mentioned out there but none of them worked on NixOS 24.11 with Steam.

I tried both, neither worked.

Code: Select all

XCURSOR_THEME=breeze_cursors
and

Code: Select all

XCURSOR_THEME=Breeze_Light
,
Zarko
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Dec 09, 2024 8:29 pm
Contact:

Re: [raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by Zarko »

I got a workaround for a workaround working on NixOS :lol:

NixOS doesn't use standard paths as other Linux distros and it might be that the library we are trying to override the cursor theme is not finding the theme we are trying to specify with XCURSOR_THEME env var.

I installed a 3rd party theme through KDE Colors & Themes -> Cursors -> Get New (upper right corner). It got downloaded to ~/.local/share/icons - which is a predictable/static path we can then provide with XCURSOR_PATH env var.


Final working solution for me was adding the following in Steam launch options. You can use any 3rd party theme. I tried a couple.

Code: Select all

XCURSOR_PATH=${XCURSOR_PATH}:~/.local/share/icons XCURSOR_THEME=Layan-white-cursors XCURSOR_SIZE=48 %command%
I got the idea looking at the arch wiki https://wiki.archlinux.org/title/Cursor ... t_variable
cz2
Manual Inserter
Manual Inserter
Posts: 1
Joined: Mon Jan 20, 2025 7:37 pm
Contact:

Re: [raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by cz2 »

Another workaround for NixOS and Plasma 6 on Wayland + Factorio running under Steam:

Code: Select all

XCURSOR_PATH=$(readlink -f /run/current-system/sw)/share/icons XCURSOR_THEME=breeze_cursors XCURSOR_SIZE=48 %command%
Steam container runtime does not share /run/current-system into the game container, so only a couple of XCURSOR_PATH directories get propagated into it - in my case only the "hicolor" theme was being shared:

Code: Select all

$ sudo nsenter -t $FACTORIO_PID -e -m ls /run/host/share/icons
hicolor
Doing the readlink trick puts the directory reachable from container into XCURSOR_PATH:

Code: Select all

$ ls $(readlink -f /run/current-system/sw)/share/icons
breeze  breeze_cursors  breeze-dark  Breeze_Light  Breeze_Snow  default  hicolor  locolor
User avatar
riking
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Thu May 05, 2016 5:35 pm
Contact:

Re: [raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by riking »

This was the first fix that actually worked for me, but all I need is the path:

Code: Select all

XCURSOR_PATH=$(readlink -f /run/current-system/sw)/share/icons %command%
I think we should get this added to the nixpkgs steam wrapper.
CrackerJackMack
Manual Inserter
Manual Inserter
Posts: 1
Joined: Thu Jan 23, 2025 2:41 am
Contact:

Re: [raiguard][1.1.107][Linux] Tiny Cursor through Wayland

Post by CrackerJackMack »

(I realize this is for wayland but figured I'd share as it happened on x11 too)

I was having a very similar issue to this, but it was only triggered when I hovered over an inventory square for the first time. It never recovered and my cursor would stay the small no theme default cursor. What fixed it for me was changing the cursor theme from the mint default to one I found on gnome-look.org and specifying XCURSOR_SIZE=48. Now my cursor stays the correct size and keeps the same theme. I'm assuming there is a missing icon in the theme that can't load, causing this undesirable condition in game. This thread led me down right path.

Without the cursor size setting, when hovering over an inventory tile it would trigger the downsize and remain that size for the session.

Code: Select all

$ loginctl show-session c1 -p Type
Type=x11
TL;DR, just like the thread says. Use a good icon pack and set the size. Thanks folks!
Post Reply

Return to “Resolved Problems and Bugs”