nixosTests.xmonad: don't rely on xmonad being "vanilla" after restart

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.
This commit is contained in:
Dominik Xaver Hörl 2020-10-10 22:33:45 +02:00
parent 67eb45ddce
commit 0a42b8cac6

View file

@ -14,9 +14,16 @@ import ./make-test-python.nix ({ pkgs, ...} : {
extraPackages = with pkgs.haskellPackages; haskellPackages: [ xmobar ];
config = ''
import XMonad
import XMonad.Operations (restart)
import XMonad.Util.EZConfig
main = launch $ def `additionalKeysP` myKeys
myKeys = [ ("M-C-x", spawn "xterm") ]
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) ]
'';
};
};
@ -30,12 +37,11 @@ import ./make-test-python.nix ({ pkgs, ...} : {
machine.send_key("alt-ctrl-x")
machine.wait_for_window("${user.name}.*machine")
machine.sleep(1)
machine.screenshot("terminal")
machine.wait_until_succeeds("xmonad --restart")
machine.screenshot("terminal1")
machine.send_key("alt-q")
machine.sleep(3)
machine.send_key("alt-shift-ret")
machine.wait_for_window("${user.name}.*machine")
machine.sleep(1)
machine.screenshot("terminal")
machine.screenshot("terminal2")
'';
})