current
linted
This commit is contained in:
parent
4e99a0e323
commit
7485de646a
95 changed files with 2743 additions and 2282 deletions
|
@ -2,22 +2,44 @@
|
|||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
inherit (builtins) getAttr stringLength substring;
|
||||
inherit (lib) mkOption getExe listToAttrs attrsToList imap;
|
||||
inherit (lib.attrsets) filterAttrs mapAttrs mapAttrs' nameValuePair;
|
||||
inherit (lib)
|
||||
mkOption
|
||||
getExe
|
||||
listToAttrs
|
||||
attrsToList
|
||||
imap
|
||||
;
|
||||
inherit (lib.attrsets)
|
||||
mapAttrs
|
||||
mapAttrs'
|
||||
nameValuePair
|
||||
;
|
||||
inherit (lib.strings) concatStringsSep toUpper;
|
||||
|
||||
enumerate = a:
|
||||
listToAttrs (imap (id: {
|
||||
name,
|
||||
value,
|
||||
}: {
|
||||
inherit name;
|
||||
value = value // {inherit id;};
|
||||
}) (attrsToList a));
|
||||
make-app-profiles = cfg:
|
||||
mapAttrs' (name: cfg:
|
||||
enumerate =
|
||||
a:
|
||||
listToAttrs (
|
||||
imap (
|
||||
id:
|
||||
{
|
||||
name,
|
||||
value,
|
||||
}:
|
||||
{
|
||||
inherit name;
|
||||
value = value // {
|
||||
inherit id;
|
||||
};
|
||||
}
|
||||
) (attrsToList a)
|
||||
);
|
||||
make-app-profiles =
|
||||
cfg:
|
||||
mapAttrs' (
|
||||
name: cfg:
|
||||
nameValuePair "home-manager-webapp-${name}" {
|
||||
inherit (cfg) id;
|
||||
userChrome = ''
|
||||
|
@ -46,39 +68,39 @@
|
|||
}
|
||||
'';
|
||||
|
||||
settings =
|
||||
cfg.extraSettings
|
||||
// {
|
||||
"browser.startup.homepage" = builtins.toString cfg.url;
|
||||
"browser.sessionstore.resume_session_once" = false;
|
||||
"browser.sessionstore.resume_from_crash" = false;
|
||||
"browser.cache.disk.enable" = false;
|
||||
"browser.cache.disk.capacity" = 0;
|
||||
"browser.cache.disk.filesystem_reported" = 1;
|
||||
"browser.cache.disk.smart_size.enabled" = false;
|
||||
"browser.cache.disk.smart_size.first_run" = false;
|
||||
"browser.cache.disk.smart_size.use_old_max" = false;
|
||||
"browser.ctrlTab.previews" = true;
|
||||
"browser.tabs.warnOnClose" = false;
|
||||
"plugin.state.flash" = 2;
|
||||
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
||||
"browser.tabs.drawInTitlebar" = false;
|
||||
"browser.tabs.inTitlebar" = 0;
|
||||
"browser.contentblocking.category" = "strict";
|
||||
"network.cookie.lifetimePolicy" = 0;
|
||||
"layout.css.prefers-color-scheme.content-override" = getAttr cfg.theme {
|
||||
dark = 0;
|
||||
light = 1;
|
||||
system = 2;
|
||||
};
|
||||
settings = cfg.extraSettings // {
|
||||
"browser.startup.homepage" = builtins.toString cfg.url;
|
||||
"browser.sessionstore.resume_session_once" = false;
|
||||
"browser.sessionstore.resume_from_crash" = false;
|
||||
"browser.cache.disk.enable" = false;
|
||||
"browser.cache.disk.capacity" = 0;
|
||||
"browser.cache.disk.filesystem_reported" = 1;
|
||||
"browser.cache.disk.smart_size.enabled" = false;
|
||||
"browser.cache.disk.smart_size.first_run" = false;
|
||||
"browser.cache.disk.smart_size.use_old_max" = false;
|
||||
"browser.ctrlTab.previews" = true;
|
||||
"browser.tabs.warnOnClose" = false;
|
||||
"plugin.state.flash" = 2;
|
||||
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
||||
"browser.tabs.drawInTitlebar" = false;
|
||||
"browser.tabs.inTitlebar" = 0;
|
||||
"browser.contentblocking.category" = "strict";
|
||||
"network.cookie.lifetimePolicy" = 0;
|
||||
"layout.css.prefers-color-scheme.content-override" = getAttr cfg.theme {
|
||||
dark = 0;
|
||||
light = 1;
|
||||
system = 2;
|
||||
};
|
||||
})
|
||||
cfg;
|
||||
in {
|
||||
};
|
||||
}
|
||||
) cfg;
|
||||
in
|
||||
{
|
||||
options.programs.firefox.webapps = mkOption {
|
||||
default = {};
|
||||
default = { };
|
||||
|
||||
type = with lib.types;
|
||||
type =
|
||||
with lib.types;
|
||||
attrsOf (submodule {
|
||||
options = {
|
||||
####################
|
||||
|
@ -102,13 +124,13 @@ in {
|
|||
|
||||
extraArgs = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = "Extra args to launch Firefox with.";
|
||||
};
|
||||
|
||||
extraSettings = mkOption {
|
||||
type = attrsOf (either bool (either int str));
|
||||
default = {};
|
||||
default = { };
|
||||
description = "Additional Firefox profile settings.";
|
||||
};
|
||||
|
||||
|
@ -119,7 +141,11 @@ in {
|
|||
};
|
||||
|
||||
theme = mkOption {
|
||||
type = enum ["dark" "light" "system"];
|
||||
type = enum [
|
||||
"dark"
|
||||
"light"
|
||||
"system"
|
||||
];
|
||||
default = "system";
|
||||
description = "The application CSS theme to use, if supported.";
|
||||
};
|
||||
|
@ -138,7 +164,11 @@ in {
|
|||
mimeType = mkOption {
|
||||
description = "The MIME type(s) supported by this application.";
|
||||
type = nullOr (listOf str);
|
||||
default = ["text/html" "text/xml" "application/xhtml_xml"];
|
||||
default = [
|
||||
"text/html"
|
||||
"text/xml"
|
||||
"application/xhtml_xml"
|
||||
];
|
||||
};
|
||||
|
||||
# Copied verbatim from xdg.desktopEntries.
|
||||
|
@ -183,40 +213,48 @@ in {
|
|||
config = {
|
||||
programs.firefox.profiles = make-app-profiles (enumerate config.programs.firefox.webapps);
|
||||
|
||||
xdg.desktopEntries =
|
||||
mapAttrs (name: cfg: {
|
||||
inherit (cfg) genericName comment categories icon mimeType prefersNonDefaultGPU;
|
||||
xdg.desktopEntries = mapAttrs (name: cfg: {
|
||||
inherit (cfg)
|
||||
genericName
|
||||
comment
|
||||
categories
|
||||
icon
|
||||
mimeType
|
||||
prefersNonDefaultGPU
|
||||
;
|
||||
|
||||
name =
|
||||
if cfg.name == null
|
||||
then (toUpper (substring 0 1 name)) + (substring 1 (stringLength name) name)
|
||||
else cfg.name;
|
||||
name =
|
||||
if cfg.name == null then
|
||||
(toUpper (substring 0 1 name)) + (substring 1 (stringLength name) name)
|
||||
else
|
||||
cfg.name;
|
||||
|
||||
startupNotify = true;
|
||||
terminal = false;
|
||||
type = "Application";
|
||||
startupNotify = true;
|
||||
terminal = false;
|
||||
type = "Application";
|
||||
|
||||
exec = concatStringsSep " " ([
|
||||
"${getExe config.programs.firefox.package}"
|
||||
"--name"
|
||||
"${name}"
|
||||
"--app-id"
|
||||
"${name}"
|
||||
"--class"
|
||||
"${name}"
|
||||
"-P"
|
||||
"${config.programs.firefox.profiles."home-manager-webapp-${name}".path}"
|
||||
"--no-remote"
|
||||
]
|
||||
++ cfg.extraArgs
|
||||
++ ["${cfg.url}"]);
|
||||
exec = concatStringsSep " " (
|
||||
[
|
||||
"${getExe config.programs.firefox.package}"
|
||||
"--name"
|
||||
"${name}"
|
||||
"--app-id"
|
||||
"${name}"
|
||||
"--class"
|
||||
"${name}"
|
||||
"-P"
|
||||
"${config.programs.firefox.profiles."home-manager-webapp-${name}".path}"
|
||||
"--no-remote"
|
||||
]
|
||||
++ cfg.extraArgs
|
||||
++ [ "${cfg.url}" ]
|
||||
);
|
||||
|
||||
settings = {
|
||||
X-MultipleArgs = "false"; # Consider enabling, don't know what this does
|
||||
StartupWMClass = "${name}";
|
||||
NoDisplay = lib.boolToString cfg.hidden;
|
||||
};
|
||||
})
|
||||
config.programs.firefox.webapps;
|
||||
settings = {
|
||||
X-MultipleArgs = "false"; # Consider enabling, don't know what this does
|
||||
StartupWMClass = "${name}";
|
||||
NoDisplay = lib.boolToString cfg.hidden;
|
||||
};
|
||||
}) config.programs.firefox.webapps;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue