nix_config/home/modules/firefox.nix

41 lines
955 B
Nix

{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.local.apps.firefox;
in {
options.local.apps.firefox = {
enable = mkEnableOption "firefox settings";
workspace = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Workspace in which Firefox should open. If not set, Firefox will not open at startup.
'';
};
};
config = mkIf cfg.enable {
programs.firefox.enable = true;
xdg = {
mimeApps = {
enable = true;
defaultApplications = {
"text/uri-list" = with pkgs; ["firefox"];
"x-scheme-handler/http" = with pkgs; ["firefox"];
"x-scheme-handler/https" = with pkgs; ["firefox"];
};
};
};
xsession.windowManager.i3.config.startup = optional (cfg.workspace != null) {
command = "${lib.getExe pkgs.i3-gaps} 'workspace ${cfg.workspace}; exec ${lib.getExe pkgs.firefox}'";
};
};
}