From 852813689a335399e30f83e0659666f3e312716e Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Sun, 16 Apr 2017 18:59:44 +0200 Subject: [PATCH] desktop-managers: Use a black BG as fallback Use a solid black background when no background image (via ~/.background-image) is provided. In my case this fixes the really strange behaviour when i3 without a desktop manager starts with the SDDM login screen as background image. --- nixos/modules/services/x11/desktop-managers/default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix index af01f6acad18..d56050c36269 100644 --- a/nixos/modules/services/x11/desktop-managers/default.nix +++ b/nixos/modules/services/x11/desktop-managers/default.nix @@ -8,7 +8,7 @@ let cfg = xcfg.desktopManager; # If desktop manager `d' isn't capable of setting a background and - # the xserver is enabled, the `feh' program is used as a fallback. + # the xserver is enabled, `feh' or `xsetroot' are used as a fallback. needBGCond = d: ! (d ? bgSupport && d.bgSupport) && xcfg.enable; in @@ -44,8 +44,11 @@ in manage = "desktop"; start = d.start + optionalString (needBGCond d) '' - if test -e $HOME/.background-image; then + if [ -e $HOME/.background-image ]; then ${pkgs.feh}/bin/feh --bg-scale $HOME/.background-image + else + # Use a solid black background as fallback + ${pkgs.xorg.xsetroot}/bin/xsetroot -solid black fi ''; }) list; @@ -80,6 +83,6 @@ in config = { services.xserver.displayManager.session = cfg.session.list; environment.systemPackages = - mkIf cfg.session.needBGPackages [ pkgs.feh ]; + mkIf cfg.session.needBGPackages [ pkgs.feh ]; # xsetroot via xserver.enable }; }