diff --git a/options/custom/services/xwayland-satellite.nix b/options/custom/services/xwayland-satellite.nix new file mode 100644 index 0000000..3dab7e7 --- /dev/null +++ b/options/custom/services/xwayland-satellite.nix @@ -0,0 +1,47 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + xwayland-satellite = "${pkgs.xwayland-satellite}/bin/xwayland-satellite"; + + cfg = config.custom.services.xwayland-satellite; +in { + options.custom.services.xwayland-satellite.enable = mkOption {default = false;}; + + config = mkIf cfg.enable { + # HACK: Use official module if added + # BUG: Fractional scaling is currently not supported + # https://github.com/Supreeeme/xwayland-satellite/issues/11 + # Rootless Xwayland support as a user service + # https://github.com/Supreeeme/xwayland-satellite + + # https://github.com/Supreeeme/xwayland-satellite/blob/main/resources/xwayland-satellite.service + systemd.user.services.xwayland-satellite = { + enable = true; + + unitConfig = { + Description = "Xwayland outside your Wayland"; + BindsTo = ["graphical-session.target"]; + PartOf = ["graphical-session.target"]; + After = ["graphical-session.target"]; + Requisite = ["graphical-session.target"]; + }; + + serviceConfig = { + Type = "notify"; + NotifyAccess = "all"; + ExecStart = xwayland-satellite; + StandardOutput = "journal"; + }; + + wantedBy = ["graphical-session.target"]; + }; + + environment.sessionVariables = { + DISPLAY = ":0"; # Assume first display + }; + }; +}