anchor.diff:      if wm != "" then wm else
       if sessionType == "gnome" then "metacity" else
       if sessionType == "kde" then "none" /* started by startkde */ else
  +    if sessionType == "kde4" then "none" /* started by startkde */ else
       "twm";
   
       
  
positive.code:     pkgs.kdebase
      xorg.xset # used by startkde, non-essential
    ]
    ++ optional (videoDriver == "nvidia") [
      kernelPackages.nvidiaDrivers
    ];
  
  
    extraEtc =
      optional (sessionType == "kde")
        { source = "${pkgs.xkeyboard_config}/etc/X11/xkb";
          target = "X11/xkb";
        }
  
negative.code:       export XDG_CONFIG_DIRS=${pkgs.kdebase}/etc/xdg:${pkgs.kdelibs}/etc/xdg
        export XDG_DATA_DIRS=${pkgs.kdebase}/share
        exec ${pkgs.kdebase}/bin/startkde
  
      '' else if sessionType == "kde4" then ''
  
        # Start KDE.
        export KDEDIRS=$HOME/.nix-profile:/nix/var/nix/profiles/default:${pkgs.kde42.kdelibs}:${pkgs.kde42.kdebase}:${pkgs.kde42.kdebase_runtime}:${pkgs.kde42.kdebase_workspace}
        export XDG_CONFIG_DIRS=${pkgs.kde42.kdelibs}/etc/xdg:${pkgs.kde42.kdebase_runtime}/etc/xdg:${pkgs.kde42.kdebase_workspace}/etc/xdg
        export XDG_DATA_DIRS=${pkgs.kde42.kdelibs}/share:${pkgs.kde42.kdebase}/share:${pkgs.kde42.kdebase_runtime}/share:${pkgs.kde42.kdebase_workspace}/share:${pkgs.shared_mime_info}/share
        exec ${pkgs.kde42.kdebase_workspace}/bin/startkde
  
      '' else ''
  
  