2025-04-01 20:10:43 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2010-08-08 14:05:32 +00:00
|
|
|
|
2009-01-25 15:49:08 +00:00
|
|
|
let
|
2024-04-30 17:42:24 +02:00
|
|
|
inherit (lib) mkOption types;
|
2010-08-08 14:05:32 +00:00
|
|
|
|
2009-06-25 22:08:03 +00:00
|
|
|
xcfg = config.services.xserver;
|
|
|
|
cfg = xcfg.desktopManager;
|
2009-01-25 15:49:08 +00:00
|
|
|
|
2014-03-04 09:10:23 +01:00
|
|
|
# If desktop manager `d' isn't capable of setting a background and
|
2017-04-16 18:59:44 +02:00
|
|
|
# the xserver is enabled, `feh' or `xsetroot' are used as a fallback.
|
2025-04-01 20:10:43 +02:00
|
|
|
needBGCond = d: !(d ? bgSupport && d.bgSupport) && xcfg.enable;
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2009-01-25 15:49:08 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2010-08-08 14:05:32 +00:00
|
|
|
# Note: the order in which desktop manager modules are imported here
|
|
|
|
# determines the default: later modules (if enabled) are preferred.
|
2017-02-25 14:43:13 -06:00
|
|
|
# E.g., if Plasma 5 is enabled, it supersedes xterm.
|
2014-07-21 12:05:57 +02:00
|
|
|
imports = [
|
2025-04-01 20:10:43 +02:00
|
|
|
./none.nix
|
|
|
|
./xterm.nix
|
|
|
|
./phosh.nix
|
|
|
|
./xfce.nix
|
|
|
|
./plasma5.nix
|
|
|
|
../../desktop-managers/plasma6.nix
|
|
|
|
./lumina.nix
|
|
|
|
./lxqt.nix
|
|
|
|
./enlightenment.nix
|
|
|
|
./retroarch.nix
|
|
|
|
./kodi.nix
|
|
|
|
./mate.nix
|
|
|
|
./pantheon.nix
|
|
|
|
./surf-display.nix
|
|
|
|
./cde.nix
|
|
|
|
./cinnamon.nix
|
|
|
|
./budgie.nix
|
|
|
|
./deepin.nix
|
|
|
|
../../desktop-managers/lomiri.nix
|
2025-03-24 01:39:32 +05:30
|
|
|
../../desktop-managers/cosmic.nix
|
2025-05-28 14:27:36 +03:00
|
|
|
../../desktop-managers/gnome.nix
|
2014-07-21 12:05:57 +02:00
|
|
|
];
|
2009-01-25 15:49:08 +00:00
|
|
|
|
2009-09-15 08:33:45 +00:00
|
|
|
options = {
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2009-09-15 08:33:45 +00:00
|
|
|
services.xserver.desktopManager = {
|
2009-01-25 15:49:08 +00:00
|
|
|
|
2017-05-03 22:56:39 +02:00
|
|
|
wallpaper = {
|
|
|
|
mode = mkOption {
|
2025-04-01 20:10:43 +02:00
|
|
|
type = types.enum [
|
|
|
|
"center"
|
|
|
|
"fill"
|
|
|
|
"max"
|
|
|
|
"scale"
|
|
|
|
"tile"
|
|
|
|
];
|
2017-05-03 22:56:39 +02:00
|
|
|
default = "scale";
|
|
|
|
example = "fill";
|
2024-04-13 14:54:15 +02:00
|
|
|
description = ''
|
2022-08-05 19:39:00 +02:00
|
|
|
The file {file}`~/.background-image` is used as a background image.
|
2017-05-05 21:21:32 +02:00
|
|
|
This option specifies the placement of this image onto your desktop.
|
|
|
|
|
|
|
|
Possible values:
|
2022-08-05 19:39:00 +02:00
|
|
|
`center`: Center the image on the background. If it is too small, it will be surrounded by a black border.
|
|
|
|
`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.
|
|
|
|
`max`: Like `fill`, but scale the image to the maximum size that fits the screen with black borders on one side.
|
|
|
|
`scale`: Fit the file into the background without repeating it, cutting off stuff or using borders. But the aspect ratio is not preserved either.
|
|
|
|
`tile`: Tile (repeat) the image in case it is too small for the screen.
|
2017-05-03 22:56:39 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
combineScreens = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2024-04-13 14:54:15 +02:00
|
|
|
description = ''
|
2022-08-05 19:39:00 +02:00
|
|
|
When set to `true` the wallpaper will stretch across all screens.
|
|
|
|
When set to `false` the wallpaper is duplicated to all screens.
|
2017-05-03 22:56:39 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2009-09-15 08:33:45 +00:00
|
|
|
session = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
internal = true;
|
2025-04-01 20:10:43 +02:00
|
|
|
default = [ ];
|
|
|
|
example = lib.singleton {
|
|
|
|
name = "kde";
|
|
|
|
bgSupport = true;
|
|
|
|
start = "...";
|
|
|
|
};
|
2024-04-13 14:54:15 +02:00
|
|
|
description = ''
|
2009-09-15 08:33:45 +00:00
|
|
|
Internal option used to add some common line to desktop manager
|
|
|
|
scripts before forwarding the value to the
|
2022-08-29 01:38:36 +02:00
|
|
|
`displayManager`.
|
2013-10-30 17:37:45 +01:00
|
|
|
'';
|
2025-04-01 20:10:43 +02:00
|
|
|
apply = map (
|
|
|
|
d:
|
|
|
|
d
|
|
|
|
// {
|
|
|
|
manage = "desktop";
|
|
|
|
start =
|
|
|
|
d.start
|
|
|
|
# literal newline to ensure d.start's last line is not appended to
|
|
|
|
+ lib.optionalString (needBGCond d) ''
|
2022-07-01 16:10:14 +04:00
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
if [ -e $HOME/.background-image ]; then
|
|
|
|
${pkgs.feh}/bin/feh --bg-${cfg.wallpaper.mode} ${lib.optionalString cfg.wallpaper.combineScreens "--no-xinerama"} $HOME/.background-image
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
);
|
2009-09-15 08:33:45 +00:00
|
|
|
};
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
|
|
};
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2009-01-25 15:49:08 +00:00
|
|
|
};
|
|
|
|
|
2020-01-23 02:24:16 +01:00
|
|
|
config.services.xserver.displayManager.session = cfg.session;
|
2009-01-25 15:49:08 +00:00
|
|
|
}
|