mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-21 21:54:10 +00:00
0a42b8cac6
The old (slightly broken) behavior of the xmonad module was to put the vanilla xmonad binary into PATH. This was changed to put the users xmonad into PATH instead. But since the config for the xmonad test uses `launch` (to avoid xmonads self-recompilation logic), it now can't handle the `--restart` flag anymore. So instead use a key binding for restarting, and let xmonad spawn a new xterm on restart. The key binding has to be explicitly added because the default binding will shell out to `xmonad --restart` and therefore not work with the `launch` entrypoint.
48 lines
1.5 KiB
Nix
48 lines
1.5 KiB
Nix
import ./make-test-python.nix ({ pkgs, ...} : {
|
|
name = "xmonad";
|
|
meta = with pkgs.stdenv.lib.maintainers; {
|
|
maintainers = [ nequissimus ];
|
|
};
|
|
|
|
machine = { pkgs, ... }: {
|
|
imports = [ ./common/x11.nix ./common/user-account.nix ];
|
|
test-support.displayManager.auto.user = "alice";
|
|
services.xserver.displayManager.defaultSession = "none+xmonad";
|
|
services.xserver.windowManager.xmonad = {
|
|
enable = true;
|
|
enableContribAndExtras = true;
|
|
extraPackages = with pkgs.haskellPackages; haskellPackages: [ xmobar ];
|
|
config = ''
|
|
import XMonad
|
|
import XMonad.Operations (restart)
|
|
import XMonad.Util.EZConfig
|
|
import XMonad.Util.SessionStart
|
|
|
|
main = launch $ def { startupHook = startup } `additionalKeysP` myKeys
|
|
|
|
startup = isSessionStart >>= \sessInit ->
|
|
if sessInit then setSessionStarted else spawn "xterm"
|
|
|
|
myKeys = [ ("M-C-x", spawn "xterm"), ("M-q", restart "xmonad" True) ]
|
|
'';
|
|
};
|
|
};
|
|
|
|
testScript = { nodes, ... }: let
|
|
user = nodes.machine.config.users.users.alice;
|
|
in ''
|
|
machine.wait_for_x()
|
|
machine.wait_for_file("${user.home}/.Xauthority")
|
|
machine.succeed("xauth merge ${user.home}/.Xauthority")
|
|
machine.send_key("alt-ctrl-x")
|
|
machine.wait_for_window("${user.name}.*machine")
|
|
machine.sleep(1)
|
|
machine.screenshot("terminal1")
|
|
machine.send_key("alt-q")
|
|
machine.sleep(3)
|
|
machine.wait_for_window("${user.name}.*machine")
|
|
machine.sleep(1)
|
|
machine.screenshot("terminal2")
|
|
'';
|
|
})
|