at 23.11-pre 3.5 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 ./phosh.nix ./xfce.nix ./plasma5.nix ./lumina.nix 22 ./lxqt.nix ./enlightenment.nix ./gnome.nix ./retroarch.nix ./kodi.nix 23 ./mate.nix ./pantheon.nix ./surf-display.nix ./cde.nix 24 ./cinnamon.nix ./budgie.nix ./deepin.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 = lib.mdDoc '' 37 The file {file}`~/.background-image` is used as a background image. 38 This option specifies the placement of this image onto your desktop. 39 40 Possible values: 41 `center`: Center the image on the background. If it is too small, it will be surrounded by a black border. 42 `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. 43 `max`: Like `fill`, but scale the image to the maximum size that fits the screen with black borders on one side. 44 `scale`: Fit the file into the background without repeating it, cutting off stuff or using borders. But the aspect ratio is not preserved either. 45 `tile`: 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 = lib.mdDoc '' 53 When set to `true` the wallpaper will stretch across all screens. 54 When set to `false` 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 = lib.mdDoc '' 68 Internal option used to add some common line to desktop manager 69 scripts before forwarding the value to the 70 `displayManager`. 71 ''; 72 apply = map (d: d // { 73 manage = "desktop"; 74 start = d.start 75 # literal newline to ensure d.start's last line is not appended to 76 + optionalString (needBGCond d) '' 77 78 if [ -e $HOME/.background-image ]; then 79 ${pkgs.feh}/bin/feh --bg-${cfg.wallpaper.mode} ${optionalString cfg.wallpaper.combineScreens "--no-xinerama"} $HOME/.background-image 80 fi 81 ''; 82 }); 83 }; 84 85 default = mkOption { 86 type = types.nullOr types.str; 87 default = null; 88 example = "none"; 89 description = lib.mdDoc '' 90 **Deprecated**, please use [](#opt-services.xserver.displayManager.defaultSession) instead. 91 92 Default desktop manager loaded if none have been chosen. 93 ''; 94 }; 95 96 }; 97 98 }; 99 100 config.services.xserver.displayManager.session = cfg.session; 101}