mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-02 15:41:48 +00:00
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 7aaf526225
.
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.
This commit is contained in:
parent
1a7671c704
commit
98d2e797e8
@ -24,7 +24,6 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : {
|
||||
services.xserver.desktopManager.gnome.enable = true;
|
||||
services.xserver.desktopManager.gnome.debug = true;
|
||||
services.xserver.displayManager.defaultSession = "gnome-xorg";
|
||||
programs.gnome-terminal.enable = true;
|
||||
|
||||
systemd.user.services = {
|
||||
"org.gnome.Shell@x11" = {
|
||||
@ -61,10 +60,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 "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 Xorg with GDM"):
|
||||
@ -82,13 +81,14 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : {
|
||||
"${startingUp} | grep -q 'true,..false'"
|
||||
)
|
||||
|
||||
with subtest("Open Gnome Terminal"):
|
||||
with subtest("Open Console"):
|
||||
machine.succeed(
|
||||
"${gnomeTerminalCommand}"
|
||||
"${launchConsole}"
|
||||
)
|
||||
# correct output should be (true, '"Gnome-terminal"')
|
||||
# correct output should be (true, '"kgx"')
|
||||
# For some reason, this deviates from Wayland.
|
||||
machine.wait_until_succeeds(
|
||||
"${wmClass} | grep -q 'true,...Gnome-terminal'"
|
||||
"${wmClass} | grep -q 'true,...kgx'"
|
||||
)
|
||||
machine.sleep(20)
|
||||
machine.screenshot("screen")
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user