about summary refs log tree commit diff
path: root/nixos/tests/gnome.nix
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2023-04-06 02:54:37 +0200
committerJan Tojnar <jtojnar@gmail.com>2023-04-06 04:19:08 +0200
commit98d2e797e8f879a3ac7f608eac9c4c08181d874c (patch)
tree6c2393b285c665bb75338d5b2ad80f649c1bb453 /nixos/tests/gnome.nix
parent1a7671c70462370ad0b7f7c1b81ba8a9e001b52f (diff)
nixos/tests/gnome: Do not use autostart and switch to kgx
Starting terminal with autostart makes it harder to control when it is activated.
This reverts commit 7aaf5262258a4c2e7366510d0978050f0ed965c4.

Unfortunately, we cannot simply just go back since that would fail
as mentioned in the reverted commit.
It appears that this is due to the app not being able to find DISPLAY,
since switching to a different terminal emulator will complain:

    (kgx:1612): Gtk-WARNING **: 01:12:49.988: cannot open display: :0.0

Let’s use D-Bus activation rather than executing the program through su.
That will hopefully take care of all the necessary environment variables.

And since GNOME Terminal does not support D-Bus activation for the app,
let’s switch to GNOME Console. It probably makes sense anyway,
as it is the default terminal emulator.

Also let’s unify the WMClass detection a bit. Though, weirdly,
the WMClass differs on Wayland.
Diffstat (limited to 'nixos/tests/gnome.nix')
-rw-r--r--nixos/tests/gnome.nix23
1 files changed, 9 insertions, 14 deletions
diff --git a/nixos/tests/gnome.nix b/nixos/tests/gnome.nix
index 05619cbd7d82a..5ab641f9f8487 100644
--- a/nixos/tests/gnome.nix
+++ b/nixos/tests/gnome.nix
@@ -22,14 +22,6 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : {
 
       services.xserver.desktopManager.gnome.enable = true;
       services.xserver.desktopManager.gnome.debug = true;
-      programs.gnome-terminal.enable = true;
-
-      environment.systemPackages = [
-        (pkgs.makeAutostartItem {
-          name = "org.gnome.Terminal";
-          package = pkgs.gnome.gnome-terminal;
-        })
-      ];
 
       systemd.user.services = {
         "org.gnome.Shell@wayland" = {
@@ -64,10 +56,10 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : {
     # False when startup is done
     startingUp = su "${gdbus} ${eval} Main.layoutManager._startingUp";
 
-    # Start gnome-terminal
-    gnomeTerminalCommand = su "${bus} gnome-terminal";
+    # Start Console
+    launchConsole = su "${bus} gapplication launch org.gnome.Console";
 
-    # Hopefully gnome-terminal's wm class
+    # Hopefully Console's wm class
     wmClass = su "${gdbus} ${eval} global.display.focus_window.wm_class";
   in ''
       with subtest("Login to GNOME with GDM"):
@@ -86,10 +78,13 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : {
               "${startingUp} | grep -q 'true,..false'"
           )
 
-      with subtest("Open Gnome Terminal"):
-          # correct output should be (true, '"gnome-terminal-server"')
+      with subtest("Open Console"):
+          machine.succeed(
+              "${launchConsole}"
+          )
+          # correct output should be (true, '"org.gnome.Console"')
           machine.wait_until_succeeds(
-              "${wmClass} | grep -q 'gnome-terminal-server'"
+              "${wmClass} | grep -q 'true,...org.gnome.Console'"
           )
           machine.sleep(20)
           machine.screenshot("screen")