Skip to content

Commit

Permalink
services.xserver: fix apply of default DM/WM
Browse files Browse the repository at this point in the history
This is needed to pick the first enabled DM/WM
if the default is `none`
  • Loading branch information
Ma27 committed Nov 7, 2017
1 parent 5b70c18 commit 410f0f0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nixos/modules/services/x11/desktop-managers/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ in
example = "plasma5";
description = "Default desktop manager loaded if none have been chosen.";
apply = defaultDM:
if defaultDM == "" && cfg.session.list != [] then
if defaultDM == "none" && cfg.session.list != [] then
(head cfg.session.list).name
else if any (w: w.name == defaultDM) cfg.session.list then
defaultDM
Expand Down
4 changes: 3 additions & 1 deletion nixos/modules/services/x11/window-managers/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ in
example = "wmii";
description = "Default window manager loaded if none have been chosen.";
apply = defaultWM:
if any (w: w.name == defaultWM) cfg.session then
if defaultWM == "none" && cfg.session != [] then
(head cfg.session).name
else if any (w: w.name == defaultWM) cfg.session then
defaultWM
else
throw "Default window manager (${defaultWM}) not found.";
Expand Down
4 changes: 3 additions & 1 deletion nixos/modules/services/x11/xserver.nix
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,9 @@ in
+ concatMapStringsSep ", " (x: x.output) primaryHeads;
})
{ assertion = cfg.desktopManager.default == "none" && cfg.windowManager.default == "none" -> cfg.plainX;
message = "Either the desktop manager or the window manager shouldn't be `none`! To explicitly allow this, you can also set `services.xserver.plainX` to `true`.";
message = "Either the desktop manager or the window manager shouldn't be `none`! "
+ "To explicitly allow this, you can also set `services.xserver.plainX` to `true`. "
+ "The `default` value looks for enabled WMs/DMs and select the first one.";
}
];

Expand Down

0 comments on commit 410f0f0

Please sign in to comment.