11.stylix/modules/feh/hm.nix
Devin a2d66f2547
treewide: extend stylix.imageScalingMode support
Add stylix.imageScalingMode support to all modules except:

- hyprlock
- hyprpaper
- kde
- lightdm
- sway

Closes: https://github.com/danth/stylix/issues/677
Link: https://github.com/danth/stylix/pull/678

Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
Reviewed-by: Daniel Thwaites <danth@danth.me>
2024-12-18 15:15:36 +01:00

35 lines
923 B
Nix

{ pkgs, config, lib, ... }:
{
options.stylix.targets.feh.enable =
config.lib.stylix.mkEnableTarget
"the desktop background using Feh"
true;
config.xsession.initExtra =
lib.mkIf (
config.stylix.enable
&& config.stylix.targets.feh.enable
&& (
with config.xsession.windowManager;
bspwm.enable
|| herbstluftwm.enable
|| i3.enable
|| spectrwm.enable
|| xmonad.enable
)
) (let
inherit (config.stylix) imageScalingMode;
bg-arg =
if imageScalingMode == "fill"
then "--bg-fill"
else if imageScalingMode == "center"
then "--bg-center"
else if imageScalingMode == "tile"
then "--bg-tile"
else if imageScalingMode == "stretch"
then "--bg-scale"
# Fit
else "--bg-max";
in "${pkgs.feh}/bin/feh --no-fehbg ${bg-arg} ${config.stylix.image}");
}