l browsers: add more browser, add hidden flag

This commit is contained in:
lassulus 2021-06-05 14:51:50 +02:00
parent b9d9b711b8
commit 50741642f4

View File

@ -5,7 +5,9 @@ let
cfg = config.lass.browser; cfg = config.lass.browser;
browserScripts = { browserScripts = {
chromium = "${pkgs.chromium}/bin/chromium"; brave = "${pkgs.brave}/bin/brave";
chrome = "${pkgs.google-chrome}/bin/chrome";
chromium = "${pkgs.ungoogled-chromium}/bin/chromium";
firefox = "${pkgs.firefox.override { firefox = "${pkgs.firefox.override {
extraNativeMessagingHosts = [ pkgs.tridactyl-native ]; extraNativeMessagingHosts = [ pkgs.tridactyl-native ];
}}/bin/firefox"; }}/bin/firefox";
@ -14,8 +16,9 @@ let
browser-select = let browser-select = let
sortedPaths = sort (a: b: a.value.precedence > b.value.precedence) sortedPaths = sort (a: b: a.value.precedence > b.value.precedence)
(filter (x: ! x.value.hidden)
(mapAttrsToList (name: value: { inherit name value; }) (mapAttrsToList (name: value: { inherit name value; })
cfg.config); cfg.config));
in if (lib.length sortedPaths) > 1 then in if (lib.length sortedPaths) > 1 then
pkgs.writeScriptBin "browser-select" '' pkgs.writeScriptBin "browser-select" ''
BROWSER=$(echo -e "${concatStringsSep "\\n" (map (getAttr "name") sortedPaths)}" | ${pkgs.dmenu}/bin/dmenu) BROWSER=$(echo -e "${concatStringsSep "\\n" (map (getAttr "name") sortedPaths)}" | ${pkgs.dmenu}/bin/dmenu)
@ -48,6 +51,10 @@ in {
type = types.str; type = types.str;
default = config._module.args.name; default = config._module.args.name;
}; };
hidden = mkOption {
type = types.bool;
default = false;
};
precedence = mkOption { precedence = mkOption {
type = types.int; type = types.int;
default = 0; default = 0;
@ -58,7 +65,7 @@ in {
}; };
browser = mkOption { browser = mkOption {
type = types.enum (attrNames browserScripts); type = types.enum (attrNames browserScripts);
default = "chromium"; default = "brave";
}; };
groups = mkOption { groups = mkOption {
type = types.listOf types.str; type = types.listOf types.str;