{ config, lib, pkgs, ... }: let cfg = config.sydnix.xwayland-satellite; in { options.sydnix.xwayland-satellite = { # xwayland-satellite implements rootless Xwayland in a separate # application, without the host compositor's involvement. It makes # X11 windows appear as normal windows, just like a native # Xwayland integration. While it is still somewhat experimental, # it handles a lot of applications correctly, like Steam, games # and Discord. enable = lib.mkEnableOption "XWayland outside your Wayland"; }; config = lib.mkIf cfg.enable { systemd.user.services.xwayland-satellite = let xwayland-satellite = pkgs.xwayland-satellite.override { withSystemd = true; }; in { Unit = { Description = "Xwayland outside your Wayland"; BindsTo = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ]; After = [ "graphical-session.target" ]; Requisite = [ "graphical-session.target" ]; }; Service = { Type = "notify"; NotifyAccess = "all"; ExecStart = lib.getExe xwayland-satellite; StandardOutput = "journal"; ExecStartPost = "systemctl --user set-environment DISPLAY=:0"; ExecStop = "systemctl --user unset-environment DISPLAY"; }; Install.WantedBy = [ "graphical-session.target" ]; }; }; }