{
  config,
  lib,
  ...
}: let
  cfg = config.marleyos.wayland;
in {
  options.marleyos.wayland.enable = lib.mkEnableOption "wayland";

  config = lib.mkIf cfg.enable {
    # Fix the "tray.target not found" error.
    systemd.user.targets.tray = lib.mkIf (!config.xsession.enable) {
      Unit = {
        Description = "Home Manager System Tray";
        Requires = ["graphical-session-pre.target"];
      };
    };
  };
}