Skip to content

Commit

Permalink
desktop-managers: Use a black BG as fallback
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
primeos committed Apr 29, 2017
1 parent 6343353 commit 8528136
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions nixos/modules/services/x11/desktop-managers/default.nix
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
};
}

0 comments on commit 8528136

Please sign in to comment.