diff --git a/common/desktop.nix b/common/desktop.nix index e4c3486..5173565 100644 --- a/common/desktop.nix +++ b/common/desktop.nix @@ -1,4 +1,5 @@ { + config, pkgs, flake-pkgs, ... @@ -11,6 +12,22 @@ in # Nice Wayland compositor. programs.niri.enable = true; + # So the display manager starts `niri-session` (from the desktop entry) which + # launches `niri.service`, which starts `niri --session`. Both + # `niri --session` and `niri-session` have some weird overlap that I don't + # understand, but they behave slightly differently with regards to what + # variables they import into the session, namely, `niri --session` is more + # conservative. Anyhow, this unfucks the shell level by unsetting it before + # the unit becomes active. + systemd.user.services.unset-shlvl = { + description = "Drop the SHLVL leaked into the user manager by niri-session"; + wantedBy = [ "graphical-session-pre.target" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${config.systemd.package}/bin/systemctl --user unset-environment SHLVL"; + }; + }; + # Some programs need this to know to default to Wayland. environment.sessionVariables.NIXOS_OZONE_WL = "1";