at 21.11-pre 3.6 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 7 xcfg = config.services.xserver; 8 cfg = xcfg.desktopManager; 9 10 # If desktop manager `d' isn't capable of setting a background and 11 # the xserver is enabled, `feh' or `xsetroot' are used as a fallback. 12 needBGCond = d: ! (d ? bgSupport && d.bgSupport) && xcfg.enable; 13 14in 15 16{ 17 # Note: the order in which desktop manager modules are imported here 18 # determines the default: later modules (if enabled) are preferred. 19 # E.g., if Plasma 5 is enabled, it supersedes xterm. 20 imports = [ 21 ./none.nix ./xterm.nix ./xfce.nix ./plasma5.nix ./lumina.nix 22 ./lxqt.nix ./enlightenment.nix ./gnome.nix ./kodi.nix 23 ./mate.nix ./pantheon.nix ./surf-display.nix ./cde.nix 24 ./cinnamon.nix 25 ]; 26 27 options = { 28 29 services.xserver.desktopManager = { 30 31 wallpaper = { 32 mode = mkOption { 33 type = types.enum [ "center" "fill" "max" "scale" "tile" ]; 34 default = "scale"; 35 example = "fill"; 36 description = '' 37 The file <filename>~/.background-image</filename> is used as a background image. 38 This option specifies the placement of this image onto your desktop. 39 40 Possible values: 41 <literal>center</literal>: Center the image on the background. If it is too small, it will be surrounded by a black border. 42 <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. 43 <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. 44 <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. 45 <literal>tile</literal>: Tile (repeat) the image in case it is too small for the screen. 46 ''; 47 }; 48 49 combineScreens = mkOption { 50 type = types.bool; 51 default = false; 52 description = '' 53 When set to <literal>true</literal> the wallpaper will stretch across all screens. 54 When set to <literal>false</literal> the wallpaper is duplicated to all screens. 55 ''; 56 }; 57 }; 58 59 session = mkOption { 60 internal = true; 61 default = []; 62 example = singleton 63 { name = "kde"; 64 bgSupport = true; 65 start = "..."; 66 }; 67 description = '' 68 Internal option used to add some common line to desktop manager 69 scripts before forwarding the value to the 70 <varname>displayManager</varname>. 71 ''; 72 apply = map (d: d // { 73 manage = "desktop"; 74 start = d.start 75 + optionalString (needBGCond d) '' 76 if [ -e $HOME/.background-image ]; then 77 ${pkgs.feh}/bin/feh --bg-${cfg.wallpaper.mode} ${optionalString cfg.wallpaper.combineScreens "--no-xinerama"} $HOME/.background-image 78 fi 79 ''; 80 }); 81 }; 82 83 default = mkOption { 84 type = types.nullOr types.str; 85 default = null; 86 example = "none"; 87 description = '' 88 <emphasis role="strong">Deprecated</emphasis>, please use <xref linkend="opt-services.xserver.displayManager.defaultSession"/> instead. 89 90 Default desktop manager loaded if none have been chosen. 91 ''; 92 }; 93 94 }; 95 96 }; 97 98 config.services.xserver.displayManager.session = cfg.session; 99}