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

let
  cfg = config.samfelag.modules.app.firefox;
  i3Cfg = config.samfelag.modules.desktop.wm.i3;
  hyprCfg = config.samfelag.modules.desktop.wm.hyprland;
in
{
  options.samfelag.modules.app.firefox = {
    enable = lib.mkEnableOption "firefox";
  };
  config = lib.mkIf cfg.enable {
    environment.systemPackages = with pkgs; [
      firefox
    ];

    hm.programs.firefox = {
      enable = true;
      # extensions = with pkgs.nur.repos.rycee.firefox-addons; [
      #   # See https://nur.nix-community.org/repos/rycee/
      #   firefox-color
      # ];
      profiles.default = {
        id = 0;
        name = "Default";
        isDefault = true;
      };
    };

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

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