1 { config, lib, pkgs, ... }:
4 inherit (lib) mkOption types;
6 xcfg = config.services.xserver;
7 cfg = xcfg.desktopManager;
9 # If desktop manager `d' isn't capable of setting a background and
10 # the xserver is enabled, `feh' or `xsetroot' are used as a fallback.
11 needBGCond = d: ! (d ? bgSupport && d.bgSupport) && xcfg.enable;
16 # Note: the order in which desktop manager modules are imported here
17 # determines the default: later modules (if enabled) are preferred.
18 # E.g., if Plasma 5 is enabled, it supersedes xterm.
20 ./none.nix ./xterm.nix ./phosh.nix ./xfce.nix ./plasma5.nix ../../desktop-managers/plasma6.nix ./lumina.nix
21 ./lxqt.nix ./enlightenment.nix ./gnome.nix ./retroarch.nix ./kodi.nix
22 ./mate.nix ./pantheon.nix ./surf-display.nix ./cde.nix
23 ./cinnamon.nix ./budgie.nix ./deepin.nix ../../desktop-managers/lomiri.nix
28 services.xserver.desktopManager = {
32 type = types.enum [ "center" "fill" "max" "scale" "tile" ];
36 The file {file}`~/.background-image` is used as a background image.
37 This option specifies the placement of this image onto your desktop.
40 `center`: Center the image on the background. If it is too small, it will be surrounded by a black border.
41 `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.
42 `max`: Like `fill`, but scale the image to the maximum size that fits the screen with black borders on one side.
43 `scale`: Fit the file into the background without repeating it, cutting off stuff or using borders. But the aspect ratio is not preserved either.
44 `tile`: Tile (repeat) the image in case it is too small for the screen.
48 combineScreens = mkOption {
52 When set to `true` the wallpaper will stretch across all screens.
53 When set to `false` the wallpaper is duplicated to all screens.
61 example = lib.singleton
67 Internal option used to add some common line to desktop manager
68 scripts before forwarding the value to the
71 apply = map (d: d // {
74 # literal newline to ensure d.start's last line is not appended to
75 + lib.optionalString (needBGCond d) ''
77 if [ -e $HOME/.background-image ]; then
78 ${pkgs.feh}/bin/feh --bg-${cfg.wallpaper.mode} ${lib.optionalString cfg.wallpaper.combineScreens "--no-xinerama"} $HOME/.background-image
88 config.services.xserver.displayManager.session = cfg.session;