diff --git a/modules/home/users/crumb/niri.nix b/modules/home/users/crumb/niri.nix index e86c7d7..fa47018 100644 --- a/modules/home/users/crumb/niri.nix +++ b/modules/home/users/crumb/niri.nix @@ -9,14 +9,6 @@ in { type = lib.types.nullOr lib.types.path; default = config.stylix.image; }; - # 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. - xwayland-satellite.enable = - lib.mkEnableOption "xwayland-satellite starting with Niri" - // { default = true; }; polkit.enable = lib.mkEnableOption "Niri/Gnome Polkit" // { default = true; }; swaylock.enable = @@ -67,26 +59,17 @@ in { stylix.targets.swaylock.enable = cfg.swaylock.enable; services.polkit-gnome.enable = cfg.polkit.enable; + sydnix.xwayland-satellite.enable = lib.mkDefault true; # File-picker. home.packages = [ pkgs.nautilus ]; - systemd.user.services.xwayland-satellite = - lib.mkIf cfg.xwayland-satellite.enable { - Service.ExecStart = - ["${pkgs.xwayland-satellite}/bin/xwayland-satellite"]; - Unit.After = ["niri.service"]; - Unit.PartOf = ["niri.service"]; - Install.WantedBy = ["niri.service"]; - }; - programs.niri = { settings = { # Activates some Nixpkgs patches to help run Electron applications under # Wayland. environment = { NIXOS_OZONE_WL = "1"; - DISPLAY = ":0"; XDG_CURRENT_DESKTOP = "niri"; QT_QPA_PLATFORM = "wayland"; ELECTRON_OZONE_PLATFORM_HINT = "auto"; diff --git a/modules/home/xwayland-satellite.nix b/modules/home/xwayland-satellite.nix new file mode 100644 index 0000000..a365824 --- /dev/null +++ b/modules/home/xwayland-satellite.nix @@ -0,0 +1,38 @@ +{ 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" ]; + }; + }; +} diff --git a/modules/nixos/dank-material-shell.nix b/modules/nixos/dank-material-shell.nix index 28a3102..1db71f4 100644 --- a/modules/nixos/dank-material-shell.nix +++ b/modules/nixos/dank-material-shell.nix @@ -12,6 +12,13 @@ in { enableDynamicTheming = false; }; + # Start after xwayland-satellite, if possible. So DMS can start + # with the DISPLAY env var set. + systemd.user.services.dms = { + wants = ["xwayland-satellite.service"]; + after = ["xwayland-satellite.service"]; + }; + services.displayManager.dms-greeter = { enable = true; compositor.name = assert config.sydnix.niri.enable; "niri";