{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.xsession.windowManager.xmonad.enable {
home.file = {
  ".xmonad/xmobar.hs".source = xmonad/xmobar.hs;
};
xsession = {
  scriptPath = ".hm-xsession";
  initExtra = ''
    xset dpms 380 640 1200
    ${pkgs.xorg.xsetroot}/bin/xsetroot -solid black -fg black -bg white -cursor_name left_ptr
    ${pkgs.rxvt-unicode}/bin/urxvtd -f -o
    ${pkgs.copyq}/bin/copyq &
    ${pkgs.pasystray}/bin/pasystray &
  '';
  windowManager.xmonad = {
    haskellPackages = pkgs.haskellPackages;
    #extraPackages = haskellPackages: [ ];
    enableContribAndExtras = true;
    config = xmonad/xmonad.hs;
  };
};
services.screen-locker = {
  enable = true;
  lockCmd = toString (pkgs.writeShellScript "xsecurelock" ''
    export PATH=${with pkgs; lib.makeBinPath [coreutils gnugrep xsecurelock xorg.xset]}
    XSECURELOCK_BLANK_DPMS_STATE=off \
    XSECURELOCK_BLANK_TIMEOUT=1 \
    XSECURELOCK_DIM_TIME_MS=2000 \
    XSECURELOCK_DISCARD_FIRST_KEYPRESS=0 \
    XSECURELOCK_SAVER=saver_blank \
    XSECURELOCK_SHOW_DATETIME=1 \
    XSECURELOCK_SHOW_HOSTNAME=1 \
    XSECURELOCK_SHOW_USERNAME=1 \
    XSECURELOCK_WAIT_TIME_MS=2000 \
    ${pkgs.xsecurelock}/bin/xsecurelock
  '');
    #XSECURELOCK_SWITCH_USER_COMMAND="${pkgs.lightdm}/bin/dm-tool switch-to-greeter" \
  inactiveInterval = lib.mkDefault 3; # minutes
  xautolock.detectSleep = true;
  xss-lock.extraOptions = [
    "--transfer-sleep-lock"
    #"-n" "${pkgs.xss-lock}/share/doc/xss-lock/dim-screen.sh"
  ];
};
home.packages = [
  pkgs.acpilight
  pkgs.gmrun
  pkgs.light
  pkgs.mate.caja
  pkgs.copyq
  pkgs.rxvt-unicode
  pkgs.scrot
  pkgs.stalonetray
  pkgs.wmname
  pkgs.xmobar
  pkgs.xorg.xev
  pkgs.xorg.xhost
  pkgs.xorg.xmodmap
  pkgs.xorg.xset
  pkgs.xsecurelock
  pkgs.xss-lock
];
};
}