summary refs log tree commit diff
diff options
context:
space:
mode:
authorDominik Xaver Hörl <hoe.dom@gmx.de>2020-10-10 22:33:45 +0200
committerDominik Xaver Hörl <hoe.dom@gmx.de>2020-10-12 14:48:07 +0200
commit0a42b8cac625f995b962b3aa991da8a5c9d3f64a (patch)
tree42beb0bc184c74f1f39b8e83b2647d4e1adab3cd
parent67eb45ddce9d390e1c9f7f8c709d98ad68cb0bfd (diff)
downloadnixpkgs-0a42b8cac625f995b962b3aa991da8a5c9d3f64a.tar
nixpkgs-0a42b8cac625f995b962b3aa991da8a5c9d3f64a.tar.gz
nixpkgs-0a42b8cac625f995b962b3aa991da8a5c9d3f64a.tar.bz2
nixpkgs-0a42b8cac625f995b962b3aa991da8a5c9d3f64a.tar.lz
nixpkgs-0a42b8cac625f995b962b3aa991da8a5c9d3f64a.tar.xz
nixpkgs-0a42b8cac625f995b962b3aa991da8a5c9d3f64a.tar.zst
nixpkgs-0a42b8cac625f995b962b3aa991da8a5c9d3f64a.zip
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.
-rw-r--r--nixos/tests/xmonad.nix18
1 files changed, 12 insertions, 6 deletions
diff --git a/nixos/tests/xmonad.nix b/nixos/tests/xmonad.nix
index 56baae8b9d3..308dbca154f 100644
--- a/nixos/tests/xmonad.nix
+++ b/nixos/tests/xmonad.nix
@@ -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")
   '';
 })