improve firefox module

This commit is contained in:
Fabian Montero 2025-02-07 12:36:22 -06:00
parent 86cf517738
commit 95930bc83e
Signed by: fabian
GPG key ID: 1FFAC35E1798174F

View file

@ -14,27 +14,44 @@ in {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = '' description = ''
Workspace in which Firefox should open. If not set, Firefox will not open at startup. i3 Workspace in which Firefox should open. If not set, Firefox will not open at startup
'';
};
makeDefaultBrowser = mkOption {
type = types.bool;
default = true;
description = ''
Take a guess
''; '';
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable (mkMerge [
programs.firefox.enable = true; {
programs.firefox.enable = true;
xdg = { xsession.windowManager.i3.config.startup = optional (cfg.workspace != null) {
mimeApps = { command = "${lib.getExe pkgs.i3-gaps} 'workspace ${cfg.workspace}; exec ${lib.getExe pkgs.firefox}'";
enable = true; };
defaultApplications = { }
"text/uri-list" = with pkgs; ["firefox"];
"x-scheme-handler/http" = with pkgs; ["firefox"]; (mkIf cfg.makeDefaultBrowser {
"x-scheme-handler/https" = with pkgs; ["firefox"]; xdg = {
mimeApps = {
enable = true;
defaultApplications = {
"text/html" = ["firefox"];
"text/uri-list" = ["firefox"];
"x-scheme-handler/http" = ["firefox"];
"x-scheme-handler/https" = ["firefox"];
"x-scheme-handler/about" = ["firefox"];
"x-scheme-handler/unknown" = ["firefox"];
};
}; };
}; };
};
xsession.windowManager.i3.config.startup = optional (cfg.workspace != null) { home.sessionVariables.DEFAULT_BROWSER = "${lib.getExe pkgs.firefox}";
command = "${lib.getExe pkgs.i3-gaps} 'workspace ${cfg.workspace}; exec ${lib.getExe pkgs.firefox}'"; })
}; ]);
};
} }