Optionalize mkTarget's 'humanName' and 'name' arguments by inferring 'humanName' from the 'name' attribute in the /modules/<MODULE>/meta.nix file, and 'name' from the /modules/<NAME>/ directory name. Inferring the 'humanName' and 'name' arguments ensures consistency and reduces boilerplate. The 'humanName' and 'name' arguments are optionalized instead of removed because complex modules generating target derivations need to distinguish between them. Closes: https://github.com/nix-community/stylix/issues/1661
88 lines
2.2 KiB
Nix
88 lines
2.2 KiB
Nix
{
|
|
mkTarget,
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
mkTarget {
|
|
options.useWallpaper = config.lib.stylix.mkEnableWallpaper "wayfire" true;
|
|
|
|
config = [
|
|
(
|
|
{ fonts }:
|
|
{
|
|
wayland.windowManager.wayfire.settings.decoration.font =
|
|
"${fonts.monospace.name} ${toString fonts.sizes.desktop}";
|
|
}
|
|
)
|
|
(
|
|
{
|
|
cfg,
|
|
image,
|
|
imageScalingMode,
|
|
}:
|
|
let
|
|
wayfireBackground = pkgs.runCommand "wayfire-background.png" { } ''
|
|
${lib.getExe' pkgs.imagemagick "convert"} ${image} $out
|
|
'';
|
|
in
|
|
{
|
|
wayland.windowManager.wayfire.settings = {
|
|
cube = {
|
|
cubemap_image = lib.mkIf cfg.useWallpaper wayfireBackground;
|
|
skydome_texture = lib.mkIf cfg.useWallpaper wayfireBackground;
|
|
};
|
|
};
|
|
|
|
wayland.windowManager.wayfire.wf-shell.settings = {
|
|
background.image = lib.mkIf cfg.useWallpaper wayfireBackground;
|
|
background.fill_mode =
|
|
if imageScalingMode == "stretch" then
|
|
"stretch"
|
|
else if imageScalingMode == "fit" then
|
|
"preserve_aspect"
|
|
else
|
|
"fill_and_crop";
|
|
};
|
|
}
|
|
)
|
|
(
|
|
{ targets }:
|
|
{
|
|
wayland.windowManager.wayfire.wf-shell.settings.panel.menu_icon =
|
|
lib.mkIf targets.nixos-icons.enable "${pkgs.nixos-icons}/share/icons/hicolor/256x256/apps/nix-snowflake.png";
|
|
}
|
|
)
|
|
(
|
|
{ colors }:
|
|
let
|
|
rgba = rgb: a: "\\#${rgb}${a}";
|
|
rgb = (lib.flip rgba) "ff";
|
|
in
|
|
{
|
|
wayland.windowManager.wayfire = {
|
|
settings = {
|
|
cube = {
|
|
background = rgb colors.base00;
|
|
};
|
|
|
|
expo.background = rgb colors.base00;
|
|
vswitch.background = rgb colors.base00;
|
|
vswipe.background = rgb colors.base00;
|
|
core.background_color = rgb colors.base00;
|
|
|
|
decoration = {
|
|
active_color = rgb colors.base0D;
|
|
inactive_color = rgb colors.base03;
|
|
};
|
|
};
|
|
|
|
wf-shell.settings = {
|
|
panel.background_color = rgb colors.base01;
|
|
};
|
|
};
|
|
}
|
|
)
|
|
];
|
|
}
|