summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorTom Smeets <Tom.TSmeets@Gmail.com>2017-05-03 22:56:39 +0200
committerNicolas B. Pierron <nicolas.b.pierron@gmail.com>2017-05-26 14:43:33 +0000
commit6a7590d78a311d180fb68f91e7054d45ed83a294 (patch)
tree447a5799e51e96c265ea63ef5284ada64059248a /nixos
parent175ecbab9163fa6d5dc7481c6258301833e02042 (diff)
downloadnixlib-6a7590d78a311d180fb68f91e7054d45ed83a294.tar
nixlib-6a7590d78a311d180fb68f91e7054d45ed83a294.tar.gz
nixlib-6a7590d78a311d180fb68f91e7054d45ed83a294.tar.bz2
nixlib-6a7590d78a311d180fb68f91e7054d45ed83a294.tar.lz
nixlib-6a7590d78a311d180fb68f91e7054d45ed83a294.tar.xz
nixlib-6a7590d78a311d180fb68f91e7054d45ed83a294.tar.zst
nixlib-6a7590d78a311d180fb68f91e7054d45ed83a294.zip
desktopManager service: Add wallpaper options
These options are used by `feh` when setting the wallpaper.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/x11/desktop-managers/default.nix27
1 files changed, 26 insertions, 1 deletions
diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix
index d56050c36269..8328339d91d3 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:
+            <literal>center</literal>: Center the image on the background. If it is too small, it will be surrounded by a black border.
+            <literal>fill</literal>: Like <literal>scale</literal>, 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.
+            <literal>max</literal>: Like <literal>fill</literal>, but scale the image to the maximum size that fits the screen with black borders on one side.
+            <literal>scale</literal>: Fit the file into the background without repeating it, cutting off stuff or using borders. But the aspect ratio is not preserved either.
+            <literal>tile</literal>: Tile (repeat) the image in case it is too small for the screen.
+          '';
+        };
+
+        combineScreens = mkOption {
+          type = types.bool;
+          default = false;
+          description = ''
+            When set to <literal>true</literal> the wallpaper will stretch across all screens.
+            When set to <literal>false</literal> 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