treewide: use mkTarget (batch 3) (#1371)

Link: https://github.com/nix-community/stylix/pull/1371

Reviewed-by: pancho horrillo <pancho@pancho.name>
Reviewed-by: Matt Sturgeon <matt@sturgeon.me.uk>
Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
awwpotato 2025-06-03 06:58:55 -07:00 committed by GitHub
parent ced2af0622
commit aa5e3c0333
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 270 additions and 249 deletions

View file

@ -1,29 +1,22 @@
{
mkTarget,
lib,
pkgs,
config,
lib,
...
}:
let
cfg = config.stylix.targets.feh;
in
{
options.stylix.targets.feh = {
enable = config.lib.stylix.mkEnableTarget "the desktop background using Feh" (
config.stylix.image != null
);
};
mkTarget {
name = "feh";
humanName = "the desktop background using Feh";
autoEnable =
with config.services.xserver.windowManager;
xmonad.enable || i3.enable;
config.services.xserver.displayManager.sessionCommands =
lib.mkIf
(
config.stylix.enable
&& cfg.enable
&& (with config.services.xserver.windowManager; xmonad.enable || i3.enable)
)
(
configElements =
{ image, imageScalingMode }:
{
services.xserver.displayManager.sessionCommands =
let
inherit (config.stylix) imageScalingMode;
bg-arg =
if imageScalingMode == "fill" then
"--bg-fill"
@ -37,6 +30,6 @@ in
else
"--bg-max";
in
"${lib.getExe pkgs.feh} --no-fehbg ${bg-arg} ${config.stylix.image}"
);
"${lib.getExe pkgs.feh} --no-fehbg ${bg-arg} ${image}";
};
}