{ ... }: {
  flake.homeManagerModules.wisdomHardwareUconsoleGamepad =
    { config, lib, pkgs, ... }:
    let
      root = config.chiasson.home;
      cfg = config.chiasson.home.hardware.uconsoleGamepad;
    in
    {
      options.chiasson.home.hardware.uconsoleGamepad.enable = lib.mkEnableOption ''
        uConsole gamepad antimicrox profile + Hyprland exec-once when HM Hyprland is on.
      '';

      config = lib.mkIf (root.enable && cfg.enable) (lib.mkMerge [
        {
          home.packages = [ pkgs.antimicrox ];
          home.file.".config/antimicrox/uconsole.gamecontroller.amgp".text = ''
            <?xml version="1.0" encoding="UTF-8"?>
            <gamecontroller configversion="19" appversion="3.5.1">
                <sdlname>Clockwork Pi DevTerm</sdlname>
                <uniqueID>030000fdaf1e00002400000010010000785536</uniqueID>
                <stickAxisAssociation index="2" xAxis="3" yAxis="4"/>
                <stickAxisAssociation index="1" xAxis="1" yAxis="2"/>
                <vdpadButtonAssociations index="1">
                    <vdpadButtonAssociation axis="0" button="12" direction="1"/>
                    <vdpadButtonAssociation axis="0" button="13" direction="4"/>
                    <vdpadButtonAssociation axis="0" button="14" direction="8"/>
                    <vdpadButtonAssociation axis="0" button="15" direction="2"/>
                </vdpadButtonAssociations>
                <names>
                    <controlstickname index="2">Stick 2</controlstickname>
                    <controlstickname index="1">Stick 1</controlstickname>
                </names>
                <sets>
                    <set index="1">
                        <trigger index="6">
                            <throttle>positivehalf</throttle>
                        </trigger>
                        <trigger index="5">
                            <throttle>positivehalf</throttle>
                        </trigger>
                        <button index="2">
                            <slots>
                                <slot>
                                    <code>0x1000022</code>
                                    <mode>keyboard</mode>
                                </slot>
                            </slots>
                        </button>
                    </set>
                </sets>
            </gamecontroller>
          '';
        }
        (lib.mkIf (config.wayland.windowManager.hyprland.enable or false) {
          wayland.windowManager.hyprland.settings.exec-once = lib.mkAfter [
            "antimicrox --hidden --no-tray --profile ${config.home.homeDirectory}/.config/antimicrox/uconsole.gamecontroller.amgp &"
          ];
        })
      ]);
    };
}
