1 { config, lib, pkgs, ... }:
7 xcfg = config.services.xserver;
8 cfg = xcfg.desktopManager;
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;
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.
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
29 services.xserver.desktopManager = {
33 type = types.enum [ "center" "fill" "max" "scale" "tile" ];
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.
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.
49 combineScreens = mkOption {
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.
67 description = lib.mdDoc ''
68 Internal option used to add some common line to desktop manager
69 scripts before forwarding the value to the
72 apply = map (d: d // {
75 # literal newline to ensure d.start's last line is not appended to
76 + optionalString (needBGCond d) ''
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
86 type = types.nullOr types.str;
89 description = lib.mdDoc ''
90 **Deprecated**, please use [](#opt-services.xserver.displayManager.defaultSession) instead.
92 Default desktop manager loaded if none have been chosen.
100 config.services.xserver.displayManager.session = cfg.session;