{ config, lib, pkgs, inputs, ... }:

with lib;
let
  cfg = config.samfelag.modules.desktop.tools.screenshot;
  hyprCfg = config.samfelag.modules.desktop.wm.hyprland;
in
{
  options.samfelag.modules.desktop.tools.screenshot = {
    enable = mkEnableOption "Screenshot utilities";
  };

  config = mkIf cfg.enable {

    # - Screenshot utilities ---------------------
    environment.systemPackages = [
      pkgs.slurp # to select the region
      pkgs.grim  # actual screenshot program
    ];

    # - Hyprland keybindings ---------------------
    hm.wayland.windowManager.hyprland.settings = lib.mkIf hyprCfg.enable {
        bind = [
          # Screenshots
          "${hyprCfg.mod}, s, exec, $HOME/.config/grapheio/scripts/screenshot.sh region"
          "${hyprCfg.mod}, SHIFT s, exec, $HOME/.config/grapheio/scripts/screenshot.sh screen"
        ];
    };

  };
}
