{
  config,
  lib,
  inputs,
  pkgs,
  home,
  system,
  ...
}:
let
  cfg = config.modules.niri;
in
{
  imports = [ inputs.niri-flake.homeModules.niri ];
  options.modules.niri = {
    enable = lib.mkEnableOption "niri configuration module";
  };
  config = lib.mkIf cfg.enable {
    # nixpkgs.overlays = [ inputs.niri-flake.overlays.niri ];
    gtk.enable = lib.mkForce false;
    home.packages = with pkgs; [ kickoff ];
    programs = {
      niri = {
        enable = true;
        # package = pkgs.niri-unstable;
        settings = {
          input = {
            keyboard = {
              xkb = {
                layout = "gb";
              };
              numlock = true;
            };
          };
          outputs = {
            DP-3 = {
              # Philips Consumer Electronics Company PHL 272E1GZ UK02101011104
              mode = {
                width = 1920;
                height = 1080;
                refresh = 165.0;
              };
              focus-at-startup = true;
              variable-refresh-rate = true;
            };
            HDMI-A-1 = {
              position = {
                x = -1920;
                y = 0;
              };
              scale = 1;
            };
          };
          binds = {
            # Navigation
            "Mod+Shift+WheelScrollDown" = {
              hotkey-overlay.title = "Workspace Down";
              cooldown-ms = 150;
              action.focus-workspace-down = [ ];
            };
            "Mod+Shift+WheelScrollUp" = {
              hotkey-overlay.title = "Workspace Up";
              cooldown-ms = 150;
              action.focus-workspace-up = [ ];
            };
            "Mod+WheelScrollUp" = {
              hotkey-overlay.title = "Workspace Left";
              action.focus-column-right = [ ];
            };
            "Mod+WheelScrollDown" = {
              hotkey-overlay.title = "Workspace Right";
              action.focus-column-left = [ ];
            };
            "Super+Tab" = {
              hotkey-overlay.title = "Overview";
              action.toggle-overview = [ ];
            };
            # --
            # Utility
            "Super+S" = {
              action.screenshot = [ ];
            };
            "Super+C" = {
              action.close-window = [ ];
            };
            "Super+L" = {
              action.spawn = "wlogout";
            };
            # Program Spawning
            "Mod+T".action.spawn = "helium";
            "Mod+R".action.spawn = "kickoff";
            "Mod+Q".action.spawn = "kitty";
            # --
          };
          window-rules = [
            {
              matches = [ ];
              geometry-corner-radius = {
                bottom-left = 3.0;
                bottom-right = 3.0;
                top-left = 3.0;
                top-right = 3.0;
              };
              clip-to-geometry = true;
              draw-border-with-background = false;
              focus-ring.width = 2;
            }
          ];
          xwayland-satellite = {
            enable = true;
          };
        };
      };
      wlogout = {
        enable = true;
        layout = [
          {
            "label" = "lock";
            "action" = "hyprlock";
            "text" = "Lock";
            "keybind" = "l";
          }
          {
            "label" = "hibernate";
            "action" = "systemctl hibernate";
            "text" = "Hibernate";
            "keybind" = "h";
          }
          {
            "label" = "logout";
            "action" = "loginctl terminate-user $USER";
            "text" = "Logout";
            "keybind" = "e";
          }
          {
            # TODO add hypr shutdown
            "label" = "shutdown";
            "action" = "systemctl poweroff";
            "text" = "Shutdown";
            "keybind" = "s";
          }
          {
            "label" = "suspend";
            "action" = "systemctl suspend";
            "text" = "Suspend";
            "keybind" = "u";
          }
          {
            "label" = "reboot";
            "action" = "systemctl reboot";
            "text" = "Reboot";
            "keybind" = "r";
          }
        ];
      };
    };
  };
}
