feat: support custom icons (#196)
Resolves https://github.com/0xc000022070/zen-browser-flake/issues/195.
This commit is contained in:
@@ -71,6 +71,12 @@ in {
|
||||
description = "Extra preferences to be included.";
|
||||
};
|
||||
|
||||
icon = mkOption {
|
||||
type = types.nullOr (types.either types.str types.path);
|
||||
default = null;
|
||||
description = "Icon to be used for the application. It's only expected to work on Linux.";
|
||||
};
|
||||
|
||||
profiles = mkOption {
|
||||
type = with types;
|
||||
attrsOf (
|
||||
@@ -280,6 +286,12 @@ in {
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.icon == null || pkgs.stdenv.isLinux;
|
||||
message = "The 'icon' option is only supported on Linux.";
|
||||
}
|
||||
];
|
||||
programs.zen-browser = {
|
||||
package = lib.mkDefault (
|
||||
(pkgs.wrapFirefox (self.packages.${pkgs.stdenv.hostPlatform.system}."${name}-unwrapped".override {
|
||||
@@ -288,7 +300,9 @@ in {
|
||||
policies = cfg.policies;
|
||||
}) {
|
||||
icon =
|
||||
if name == "beta"
|
||||
if cfg.icon != null
|
||||
then cfg.icon
|
||||
else if name == "beta"
|
||||
then "zen-browser"
|
||||
else "zen-${name}";
|
||||
}).override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
name,
|
||||
variant,
|
||||
icon ? null,
|
||||
policies ? {},
|
||||
lib,
|
||||
stdenv,
|
||||
@@ -138,7 +139,10 @@ in
|
||||
name = binaryName;
|
||||
desktopName = "Zen Browser${lib.optionalString (name == "twilight") " Twilight"}";
|
||||
exec = "${binaryName} %u";
|
||||
icon = desktopIconName;
|
||||
icon =
|
||||
if icon != null && (lib.isString icon || lib.isPath icon)
|
||||
then icon
|
||||
else desktopIconName;
|
||||
type = "Application";
|
||||
mimeTypes = [
|
||||
"text/html"
|
||||
|
||||
Reference in New Issue
Block a user