Fixing Game Resolution on Wayland
HiDPI Scaling
In Wayland, HiDPI displays work very well and are trivial to configure. GNOME and KDE have historically handled HiDPI without issue and under sway, you can set a scale factor like this:
output output-name scale 1.25
This is adequate for 1440p. If you’re using a compositor such as hikari that lacks settings for scaling, then QT and GTK can be upscaled with environment variables and terminal text can be scaled as well. Despite native applications conforming automagically to this setting, XWayland apps don’t listen to this. Such applications will look blurry on a high resolution display. To add insult to injury, this means that XWayland games (anything not using system SDL2 with the wayland backend set) will not scale up to higher resolutions properly. This is a huge disappointment for people who want to enjoy their games at full resolution. Luckily, there is a fix!
Enter Gamescope
The saving grace for the Linux gamer on a HiDPI display is a program called gamescope. It is a fork of Valve’s steamcompmgr for Wayland. It works as follows:
- A sandboxed Xwayland desktop is spawned
- This nested sandbox launches at the desired scale and refresh rate that the user sets
- Enjoy efficient serving of your frames courtesy of asynchronous Vulkan for GPU compositing and removal of excess copies on present
Getting it
Installing gamescope is a breeze. Just run
git clone https://github.com/Plagman/gamescope.git && cd gamescope
meson build
ninja -C build
ln -s build/gamescope ~/bin/gamescope # or someplace in $PATH
Running it
In Steam, you can select your game of choice and go to Properties > General > Launch Options
. In there, you can load gamescope. The general syntax is
gamescope -w <forced-width-number> -h <forced-height-number> -W <upscale-width> -H <upscale-height> -r <refresh-rate> -- %command%
Additionally, you can use the -n
flag to force set integer scaling and -b
for pillarboxing. Setting the CS:GO launch options as
gamescope -w 2560 -h 1440 -W 2560 -H 1440 -- %command%
launched the game at the correct refresh rate of 144hz and the game was already set at the desired resolution of 2560x1440. For GOG games or other non-steam titles, gamescope works as intended; creating an executable shell script with the launch options you want will suffice. Happy gaming!