{ lib, config, inputs, pkgs, ... }:
{
  imports = [
    ../../common/desktop
  ];

  wayland.windowManager.hyprland = {
    enable = true;
    systemd = {
      enable = true;
    };

    settings = {
      general = {
        gaps_in = 15;
        gaps_out = 20;
        border_size = 2;
      };
      cursor.inactive_timeout = 4;
      animations = {
        enabled = true;
      };

      bind = let
        terminal = "${pkgs.kitty}/bin/kitty";
        workspaces = [
          "1"
          "2"
          "3"
          "4"
          "5"
        ];
        directions = rec {
          left = "l";
          right = "r";
          up = "u";
          down = "d";
          h = left;
          l = right;
          k = up;
          j = down;
        };
      in [
        "SUPER,Return,exec,${terminal}"
        "SUPERSHIFT,q,killactive" # exit program
        "SUPERSHIFT,e,exit" # exit hyprland

        "SUPER,s,togglesplit" # horizontal split
        "SUPER,f,fullscreen,1" # borderless window
        "SUPERSHIFT,f,fullscreen,0" # proper fullscreen
        "SUPERSHIFT,space,togglefloating" # floating window

        "SUPER,minus,splitratio,-0.25" # split gets slightly smaller
        "SUPERSHIFT,minus,splitratio,-0.3333333" # split gets smaller
        "SUPER,equal,splitratio,0.25" # split gets slightly larger
        "SUPERSHIFT,equal,splitratio,0.3333333" # split gets larger

        "SUPER,g,togglegroup" # make a window group
        "SUPER,t,lockactivegroup,toggle" # lock/unlock the current group
        "SUPER,tab,changegroupactive,f" # switch to next window in group
        "SUPERSHIFT,tab,changegroupactive,p" # switch to prev window in group
        
        "SUPER,dead_grave,workspace,previous" # prev workspace
        "SUPER,dead_grave,workspace,next" # next workspace

        "SUPER,u,togglespecialworkspace" # toggle special workspace
        "SUPERSHIFT,u,movetoworkspacesilent,special" # move to special workspace
      ]
      ++
      # change workspace
      (map (n: "SUPER,${n},workspace,name:${n}") workspaces)
      ++
      # move window to workspace
      (map (n: "SUPERSHIFT,${n},movetoworkspacesilent,name:${n}") workspaces)
      ++
      # move focus
      (lib.mapAttrsToList (key: direction: "SUPER,${key},movefocus,${direction}") directions)
      ++
      # swap windows
      (lib.mapAttrsToList (key: direction: "SUPERSHIFT,${key},swapwindow,${direction}") directions)
      ++
      # move windows
      (lib.mapAttrsToList (key: direction: "SUPERCONTROL,${key},movewindoworgroup,${direction}") directions);
    };
  };
}