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

let
  cfg = config.samfelag.modules.app.zen-browser;
  i3Cfg = config.samfelag.modules.desktop.wm.i3;
  hyprCfg = config.samfelag.modules.desktop.wm.hyprland;
  zen-pkg = inputs.zen-browser.packages."${system}".default;
in
{
  options.samfelag.modules.app.zen-browser = {
    enable = lib.mkEnableOption "zen-browser";
  };
  config = lib.mkIf cfg.enable {
    environment.systemPackages = with pkgs; [
      zen-pkg
    ];

    samfelag.modules.desktop.wm.i3.extraKeybindings = lib.mkIf i3Cfg.enable {
      "${i3Cfg.mod}+Shift+i" =  "exec ${zen-pkg}/bin/zen";
    };

    samfelag.modules.desktop.wm.hyprland.extraKeybindings = lib.mkIf hyprCfg.enable [
      "${hyprCfg.mod} SHIFT, i, exec, ${zen-pkg}/bin/zen"
    ];
  };
}
