treewide: use mkTarget (batch 2) (#1362)

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

Reviewed-by: Flameopathic <64027365+Flameopathic@users.noreply.github.com>
Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
awwpotato 2025-05-23 10:23:39 -07:00 committed by GitHub
parent 8dd18dd395
commit 7ffb31da69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 1355 additions and 1238 deletions

View file

@ -1,36 +1,26 @@
{
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.xsession.windowManager;
bspwm.enable
|| herbstluftwm.enable
|| i3.enable
|| spectrwm.enable
|| xmonad.enable;
config.xsession.initExtra =
lib.mkIf
(
config.stylix.enable
&& cfg.enable
&& (
with config.xsession.windowManager;
bspwm.enable
|| herbstluftwm.enable
|| i3.enable
|| spectrwm.enable
|| xmonad.enable
)
)
(
configElements =
{ imageScalingMode, image }:
{
xsession.initExtra =
let
inherit (config.stylix) imageScalingMode;
bg-arg =
if imageScalingMode == "fill" then
"--bg-fill"
@ -44,6 +34,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}";
};
}