This may be a niche use case, but the following guide explains how to substitute xwayland-satellite for xwayland in sway window manager (adapted from this reddit post).
Background: on my framework 13 laptop with a hidpi monitor using sway with libreoffice would result in double-scaling (2x from sway and 2x from libreoffice). Using xwayland would result in blurry text.
I am using regreet to launch sway, with sway configuration set by (standalone) home-manager.
- add xwayland-satellite to system configuration
# configuration.nix
environment.systemPackages = [
pkgs.xwayland-satellite
];
- Create a wrapper that points the environment variable WLR_XWAYLAND to xwayland-satellite. Then use extraConfigEarly to tell sway to start xwayland (pointed to xwayland-satellite) eagerly.
# in addition to whatever other sway configuration you have
{ config, pkgs, ... }:
let
xwaylandSatelliteWrapper = pkgs.writeShellApplication {
name = "xwayland-satellite-wrapper";
runtimeInputs = [ pkgs.sway ];
text = ''
swaymsg exec ${pkgs.xwayland-satellite}/bin/xwayland-satellite
'';
};
in
{
home.sessionVariables = {
WLR_XWAYLAND = "${xwaylandSatelliteWrapper}/bin/xwayland-satellite-wrapper";
};
wayland.windowManager.sway = {
extraConfigEarly = ''
xwayland force
'';
};
}
- Now you can create an override for the .desktop file to launch libreoffice in xwayland-satellite instead of wayland by unsetting the WAYLAND_DISPLAY variable for soffice
# in home.nix
xdg.dataFile."applications/startcenter.desktop".text = ''
[Desktop Entry]
Type=Application
Name=LibreOffice
Exec=env -u WAYLAND_DISPLAY soffice %U
Icon=libreoffice-startcenter
Categories=Office;
'';
Notes:
I’ll mention that trying to set xwayland = false; and launching xwayland-satellite as a sway startup command did not set the environment variable for DISPLAY and then libreoffice could not find the xwayland display.
The wrapper script needs swaymsg exec rather than pointing to xwayland-satellite directly because sway passes a -rootless flag, which will cause xwayland-satellite to fail with an unrecognized flag error
xwayland-satellite needs to be installed system wide so that sway can find it (did not work if only put into runtime inputs).
Hopefully this helps someone