2014-04-14 15:26:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2010-08-08 15:05:32 +01:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with lib;
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
|
|
let
|
2010-08-08 15:05:32 +01:00
|
|
|
|
2009-06-25 23:08:03 +01:00
|
|
|
xcfg = config.services.xserver;
|
|
|
|
cfg = xcfg.desktopManager;
|
2009-01-25 15:49:08 +00:00
|
|
|
|
2014-03-04 08:10:23 +00:00
|
|
|
# If desktop manager `d' isn't capable of setting a background and
|
2017-04-16 17:59:44 +01:00
|
|
|
# the xserver is enabled, `feh' or `xsetroot' are used as a fallback.
|
2014-03-04 08:10:23 +00:00
|
|
|
needBGCond = d: ! (d ? bgSupport && d.bgSupport) && xcfg.enable;
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-01-25 15:49:08 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2010-08-08 15:05:32 +01:00
|
|
|
# Note: the order in which desktop manager modules are imported here
|
|
|
|
# determines the default: later modules (if enabled) are preferred.
|
2017-02-25 20:43:13 +00:00
|
|
|
# E.g., if Plasma 5 is enabled, it supersedes xterm.
|
2014-07-21 11:05:57 +01:00
|
|
|
imports = [
|
2019-11-04 21:40:28 +00:00
|
|
|
./none.nix ./xterm.nix ./xfce.nix ./plasma5.nix ./lumina.nix
|
2017-07-04 11:42:53 +01:00
|
|
|
./lxqt.nix ./enlightenment.nix ./gnome3.nix ./kodi.nix ./maxx.nix
|
2019-08-03 18:14:45 +01:00
|
|
|
./mate.nix ./pantheon.nix ./surf-display.nix
|
2014-07-21 11:05:57 +01:00
|
|
|
];
|
2009-01-25 15:49:08 +00:00
|
|
|
|
2009-09-15 09:33:45 +01:00
|
|
|
options = {
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-09-15 09:33:45 +01:00
|
|
|
services.xserver.desktopManager = {
|
2009-01-25 15:49:08 +00:00
|
|
|
|
2017-05-03 21:56:39 +01:00
|
|
|
wallpaper = {
|
|
|
|
mode = mkOption {
|
|
|
|
type = types.enum [ "center" "fill" "max" "scale" "tile" ];
|
|
|
|
default = "scale";
|
|
|
|
example = "fill";
|
|
|
|
description = ''
|
2017-05-05 20:21:32 +01:00
|
|
|
The file <filename>~/.background-image</filename> is used as a background image.
|
|
|
|
This option specifies the placement of this image onto your desktop.
|
|
|
|
|
|
|
|
Possible values:
|
2017-05-03 21:56:39 +01:00
|
|
|
<literal>center</literal>: Center the image on the background. If it is too small, it will be surrounded by a black border.
|
|
|
|
<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.
|
|
|
|
<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.
|
|
|
|
<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.
|
|
|
|
<literal>tile</literal>: Tile (repeat) the image in case it is too small for the screen.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
combineScreens = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
When set to <literal>true</literal> the wallpaper will stretch across all screens.
|
|
|
|
When set to <literal>false</literal> the wallpaper is duplicated to all screens.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2009-09-15 09:33:45 +01:00
|
|
|
session = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
internal = true;
|
2009-09-15 09:33:45 +01:00
|
|
|
default = [];
|
2010-08-08 15:05:32 +01:00
|
|
|
example = singleton
|
|
|
|
{ name = "kde";
|
|
|
|
bgSupport = true;
|
|
|
|
start = "...";
|
|
|
|
};
|
2013-10-30 16:37:45 +00:00
|
|
|
description = ''
|
2009-09-15 09:33:45 +01:00
|
|
|
Internal option used to add some common line to desktop manager
|
|
|
|
scripts before forwarding the value to the
|
|
|
|
<varname>displayManager</varname>.
|
2013-10-30 16:37:45 +00:00
|
|
|
'';
|
2009-09-15 09:33:45 +01:00
|
|
|
apply = list: {
|
|
|
|
list = map (d: d // {
|
|
|
|
manage = "desktop";
|
|
|
|
start = d.start
|
|
|
|
+ optionalString (needBGCond d) ''
|
2017-04-16 17:59:44 +01:00
|
|
|
if [ -e $HOME/.background-image ]; then
|
2017-05-03 21:56:39 +01:00
|
|
|
${pkgs.feh}/bin/feh --bg-${cfg.wallpaper.mode} ${optionalString cfg.wallpaper.combineScreens "--no-xinerama"} $HOME/.background-image
|
2017-04-16 17:59:44 +01:00
|
|
|
else
|
|
|
|
# Use a solid black background as fallback
|
|
|
|
${pkgs.xorg.xsetroot}/bin/xsetroot -solid black
|
2009-09-15 09:33:45 +01:00
|
|
|
fi
|
|
|
|
'';
|
|
|
|
}) list;
|
|
|
|
needBGPackages = [] != filter needBGCond list;
|
2009-01-25 15:49:08 +00:00
|
|
|
};
|
2009-09-15 09:33:45 +01:00
|
|
|
};
|
2009-01-25 15:49:08 +00:00
|
|
|
|
2009-09-15 09:33:45 +01:00
|
|
|
default = mkOption {
|
2013-10-30 10:02:04 +00:00
|
|
|
type = types.str;
|
2018-03-17 19:34:10 +00:00
|
|
|
default = "";
|
|
|
|
example = "none";
|
2010-08-08 15:05:32 +01:00
|
|
|
description = "Default desktop manager loaded if none have been chosen.";
|
2009-09-15 09:33:45 +01:00
|
|
|
apply = defaultDM:
|
2018-03-17 19:34:10 +00:00
|
|
|
if defaultDM == "" && cfg.session.list != [] then
|
2010-08-08 15:05:32 +01:00
|
|
|
(head cfg.session.list).name
|
|
|
|
else if any (w: w.name == defaultDM) cfg.session.list then
|
2009-09-15 09:33:45 +01:00
|
|
|
defaultDM
|
|
|
|
else
|
2018-07-28 14:58:07 +01:00
|
|
|
builtins.trace ''
|
|
|
|
Default desktop manager (${defaultDM}) not found at evaluation time.
|
|
|
|
These are the known valid session names:
|
2016-01-31 20:57:47 +00:00
|
|
|
${concatMapStringsSep "\n " (w: "services.xserver.desktopManager.default = \"${w.name}\";") cfg.session.list}
|
2018-07-28 14:58:07 +01:00
|
|
|
It's also possible the default can be found in one of these packages:
|
|
|
|
${concatMapStringsSep "\n " (p: p.name) config.services.xserver.displayManager.extraSessionFilePackages}
|
|
|
|
'' defaultDM;
|
2009-01-25 15:49:08 +00:00
|
|
|
};
|
2009-09-15 09:33:45 +01:00
|
|
|
|
2009-01-25 15:49:08 +00:00
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-01-25 15:49:08 +00:00
|
|
|
};
|
|
|
|
|
2017-12-18 01:14:58 +00:00
|
|
|
config.services.xserver.displayManager.session = cfg.session.list;
|
2009-01-25 15:49:08 +00:00
|
|
|
}
|