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:
parent
ced2af0622
commit
aa5e3c0333
6 changed files with 270 additions and 249 deletions
|
|
@ -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}";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue