git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit852813689a335399e30f83e0659666f3e312716e authorMichael Weiss <dev.primeos@gmail.com> dateSun 16 Apr 2017, 18:59 (10 years ago) parent6343353
1 file changed+6−3
nixos/modules/services/x11/desktop-managers/default.nix+6−3
nixos/modules/services/x11/desktop-managers/default.nix+6−3
@@ -8,7 +8,7 @@ let
88 cfg = xcfg.desktopManager;
99
1010 # If desktop manager `d' isn't capable of setting a background and
11− # the xserver is enabled, the `feh' program is used as a fallback.
11+ # the xserver is enabled, `feh' or `xsetroot' are used as a fallback.
1212 needBGCond = d: ! (d ? bgSupport && d.bgSupport) && xcfg.enable;
1313
1414in
@@ -44,8 +44,11 @@ in
4444 manage = "desktop";
4545 start = d.start
4646 + optionalString (needBGCond d) ''
47− if test -e $HOME/.background-image; then
47+ if [ -e $HOME/.background-image ]; then
4848 ${pkgs.feh}/bin/feh --bg-scale $HOME/.background-image
49+ else
50+ # Use a solid black background as fallback
51+ ${pkgs.xorg.xsetroot}/bin/xsetroot -solid black
4952 fi
5053 '';
5154 }) list;
@@ -80,6 +83,6 @@ in
8083 config = {
8184 services.xserver.displayManager.session = cfg.session.list;
8285 environment.systemPackages =
83− mkIf cfg.session.needBGPackages [ pkgs.feh ];
86+ mkIf cfg.session.needBGPackages [ pkgs.feh ]; # xsetroot via xserver.enable
8487 };
8588}