nix_config/home/modules/firefox.nix

41 lines
955 B
Nix
Raw Normal View History

2025-01-28 19:28:28 +01:00
{
config,
lib,
pkgs,
...
}:
with lib; let
2025-01-31 15:28:46 +01:00
cfg = config.local.apps.firefox;
2025-01-28 19:28:28 +01:00
in {
2025-01-31 15:28:46 +01:00
options.local.apps.firefox = {
2025-01-28 19:28:28 +01:00
enable = mkEnableOption "firefox settings";
2025-01-31 15:24:40 +01:00
2025-01-28 19:28:28 +01:00
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;
2025-01-31 15:28:46 +01:00
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"];
};
};
};
2025-01-28 19:28:28 +01:00
xsession.windowManager.i3.config.startup = optional (cfg.workspace != null) {
command = "${lib.getExe pkgs.i3-gaps} 'workspace ${cfg.workspace}; exec ${lib.getExe pkgs.firefox}'";
};
};
}