{
  config,
  pkgs,
  lib,
  ...
}: {
  # Display manager
  services.xserver.enable = true;
  # services.xserver.displayManager.sddm.enable = true;
  services.xserver.displayManager.lightdm.enable = true;
  services.xserver.displayManager.autoLogin.enable = true;
  services.xserver.displayManager.autoLogin.user = "muon";
  services.xserver.displayManager.defaultSession = "none+xmonad";

  # Window manager
  #services.xserver.windowManager.leftwm.enable = true;
  #services.xserver.windowManager.herbstluftwm.enable = true;

  
  services.xserver = {
    # enable = true;
    desktopManager = {
      xterm.enable = false;
      xfce.enable = true;
    };
  };

  services.xserver.windowManager.xmonad = {
    enable = true;
    enableContribAndExtras = true;
  };
  systemd.user.services.xmobar = {
    script = "${lib.getExe pkgs.xmobar}";
    wantedBy = [ "graphical-session.target" ];
    partOf = [ "graphical-session.target" ];
  };

  # system.activationScripts = {
  #   screenlayout.text = ''
  #     ${lib.getExe pkgs.xrandr} --output DVI-D-0 --off --output HDMI-0 --off --output HDMI-1 --mode 1920x1080 --pos 2560x0 --rotate right --output DP-0 --off --output DP-1 --off --output DP-2 --primary --mode 2560x1440 --pos 0x480 --rotate normal --output DP-3 --off
  #   '';
  # };
  systemd.services.screensetter = {
    enable = true;
    description = "sets correct screen resolution";
    wantedBy = [ "graphical-session.target"];
    # Add this line in your nixos configuration (E.G. the "configuration.nix" file or a module imported into it)
    # this allows you to use `xrandr` inside of scripts called by this service
    # https://www.reddit.com/r/NixOS/comments/w4fj6p/comment/ih1oa5e/?utm_source=reddit&utm_medium=web2x&context=3
    path = [ pkgs.xorg.xrandr ];

    unitConfig = {
      type = "simple";
    };

    serviceConfig = {
      # ExecStart = "/home/<this_user>/.screenlayout/nixos-screenlayout.sh";
      ExecStart = "${config.users.users.muon.home}/.screenlayout/main.sh";
    };
  };

  # systemd.user.services.screenlayout = {
  #   script = "${config.users.users.muon.home}/.screenlayout/main.sh";
  #   wantedBy = [ "graphical-session.target" ];
  #   partOf = [ "graphical-session.target" ];
  # };

  # Wayland
  # services.xserver.displayManager.gdm.wayland = true;
  # programs.hyprland.package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
  # programs.hyprland.enable = true;

  # environment.variables = {
  #   GDK_SCALE="2";
  #   XCURSOR_SIZE="24";
  # };

  # hardware = {
  #   opengl = {
  #     enable = true;
  #     driSupport = true;
  #     driSupport32Bit = true;
  #     extraPackages = with pkgs; [
  #       vaapiVdpau
  #       libvdpau-va-gl
  #     ];
  #   };
  #   pulseaudio.support32Bit = true;
  # };

  # xdg.portal = {
  #   enable = true;
  #   wlr.enable = false;
  #   extraPortals = [
  #     pkgs.xdg-desktop-portal-gtk
  #   ];
  # };

  # sound = {
  #   enable = true;
  #   mediaKeys.enable = true;
  # };

  # Hide cursor
  services.xbanish.enable = true;

  # Install fonts
  fonts = {
      fonts = with pkgs; [
          mononoki
          openmoji-color
          (nerdfonts.override { fonts = [ "Mononoki" ]; })
      ];
      fontconfig = {
          hinting.autohint = true;
          defaultFonts = {
            emoji = [ "OpenMoji Color" ];
          };
      };
  };
}
