1import ./make-test-python.nix ({ pkgs, ...} : {
2 name = "xmonad";
3 meta = with pkgs.lib.maintainers; {
4 maintainers = [ nequissimus ];
5 };
6
7 machine = { pkgs, ... }: {
8 imports = [ ./common/x11.nix ./common/user-account.nix ];
9 test-support.displayManager.auto.user = "alice";
10 services.xserver.displayManager.defaultSession = "none+xmonad";
11 services.xserver.windowManager.xmonad = {
12 enable = true;
13 enableContribAndExtras = true;
14 extraPackages = with pkgs.haskellPackages; haskellPackages: [ xmobar ];
15 config = ''
16 import XMonad
17 import XMonad.Operations (restart)
18 import XMonad.Util.EZConfig
19 import XMonad.Util.SessionStart
20
21 main = launch $ def { startupHook = startup } `additionalKeysP` myKeys
22
23 startup = isSessionStart >>= \sessInit ->
24 if sessInit then setSessionStarted else spawn "xterm"
25
26 myKeys = [ ("M-C-x", spawn "xterm"), ("M-q", restart "xmonad" True) ]
27 '';
28 };
29 };
30
31 testScript = { nodes, ... }: let
32 user = nodes.machine.config.users.users.alice;
33 in ''
34 machine.wait_for_x()
35 machine.wait_for_file("${user.home}/.Xauthority")
36 machine.succeed("xauth merge ${user.home}/.Xauthority")
37 machine.send_key("alt-ctrl-x")
38 machine.wait_for_window("${user.name}.*machine")
39 machine.sleep(1)
40 machine.screenshot("terminal1")
41 machine.send_key("alt-q")
42 machine.sleep(3)
43 machine.wait_for_window("${user.name}.*machine")
44 machine.sleep(1)
45 machine.screenshot("terminal2")
46 '';
47})