{ config, lib, pkgs, ... }: 
let 
  baseOutput = {
    position = "0,0";
    scale = 1.0;
    adaptiveSync = true;
    status = "enable";
  };

in {

  config = lib.mkIf (config.usercfg.wm == "Wayland") {
    services.kanshi = {
      enable = true;
      systemdTarget = "graphical-session.target";
      settings = [
        {output = baseOutput//{
          criteria = "AOC 24E1W1 GNSKCHA086899";
          mode = "1920x1080@60.000";
        };}
        {output = baseOutput//{
          criteria = "AOC 24E1W1 GNSKBHA080346";
          mode = "1920x1080@60.000";
        };}
        {output = baseOutput//{
          criteria = "LG UNKNOWN_TBD";
          mode = "1920x1080@144.000";
        };}
        {output = baseOutput//{
          criteria = "LG Display 0x060A Unknown";
          mode = "1920x1080@60.020";
        };}
        {output = baseOutput//{
          criteria = "CEX CX133 0x00000001";
          mode = "2560x1600@59.972";
        };}
        {output = baseOutput//{
          criteria = "AOC 16G3 1DDP7HA000348";
          mode = "1920x1080@144.000";
        };}

        {profile = {
          name = "tower_0";
          outputs = [
            {
              criteria = "AOC 24E1W1 GNSKCHA086899";
              position = "0,0";
            }
            {
              criteria = "AOC 24E1W1 GNSKBHA080346";
              position = "1920,0";
            }
          ];
          exec = [ "${pkgs.eww}/bin/eww open bar --screen 1" ];
        };}
        {profile = {
          name = "tower_1";
          outputs = [
            {
              criteria = "AOC 24E1W1 GNSKCHA086899";
              position = "0,0";
            }
            {
              criteria = "AOC 24E1W1 GNSKBHA080346";
              position = "0,0";
            }
            {
              criteria = "LG UNKNOWN_TBD";
              position = "0,0";
            }
          ];
        };}
        {profile = {
          name = "laptop_0";
          outputs = [{
            criteria = "LG Display 0x060A Unknown";
            position = "0,0";
          }];
        };}
        {profile = {
          name = "laptop_1";
          outputs = [
            {
              criteria = "CEX CX133 0x00000001";
              position = "0,0";
            }
            {
              criteria = "LG Display 0x060A Unknown";
              position = "2560,0";
            }
          ];
        };}
        {profile = {
          name = "laptop_2";
          outputs = [
            {
              criteria = "AOC 16G3 1DDP7HA000348";
              position = "0,0";
            }
            {
              criteria = "LG Display 0x060A Unknown";
              position = "1920,0";
            }
          ];
        };}
      ];
    };
  };
}
