diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix index d56050c3626..8328339d91d 100644 --- a/nixos/modules/services/x11/desktop-managers/default.nix +++ b/nixos/modules/services/x11/desktop-managers/default.nix @@ -26,6 +26,31 @@ in services.xserver.desktopManager = { + wallpaper = { + mode = mkOption { + type = types.enum [ "center" "fill" "max" "scale" "tile" ]; + default = "scale"; + example = "fill"; + description = '' + Wallpaper image mode: + center: Center the image on the background. If it is too small, it will be surrounded by a black border. + fill: Like scale, but preserves aspect ratio by zooming the image until it fits. Either a horizontal or a vertical part of the image will be cut off. + max: Like fill, but scale the image to the maximum size that fits the screen with black borders on one side. + scale: Fit the file into the background without repeating it, cutting off stuff or using borders. But the aspect ratio is not preserved either. + tile: Tile (repeat) the image in case it is too small for the screen. + ''; + }; + + combineScreens = mkOption { + type = types.bool; + default = false; + description = '' + When set to true the wallpaper will stretch across all screens. + When set to false the wallpaper is duplicated to all screens. + ''; + }; + }; + session = mkOption { internal = true; default = []; @@ -45,7 +70,7 @@ in start = d.start + optionalString (needBGCond d) '' if [ -e $HOME/.background-image ]; then - ${pkgs.feh}/bin/feh --bg-scale $HOME/.background-image + ${pkgs.feh}/bin/feh --bg-${cfg.wallpaper.mode} ${optionalString cfg.wallpaper.combineScreens "--no-xinerama"} $HOME/.background-image else # Use a solid black background as fallback ${pkgs.xorg.xsetroot}/bin/xsetroot -solid black