diff --git a/common/flatpak-run.c b/common/flatpak-run.c index 1b640c15e..08fabee98 100644 --- a/common/flatpak-run.c +++ b/common/flatpak-run.c @@ -232,7 +232,7 @@ flatpak_run_parse_x11_display (const char *display, while (g_ascii_isdigit (*display_nr_end)) display_nr_end++; - if (display == colon) + if (display == colon || g_str_has_prefix (display, "unix:")) { *display_nr_out = g_strndup (display_nr, display_nr_end - display_nr); *x11_socket = g_strdup_printf ("/tmp/.X11-unix/X%s", *display_nr_out); diff --git a/tests/testcommon.c b/tests/testcommon.c index dfc2c4869..aecf21e0d 100644 --- a/tests/testcommon.c +++ b/tests/testcommon.c @@ -1779,6 +1779,7 @@ static const DisplayTest x11_display_tests[] = { ":0", FamilyLocal, "/tmp/.X11-unix/X0", NULL, "0" }, { ":0.0", FamilyLocal, "/tmp/.X11-unix/X0", NULL, "0" }, { ":42.0", FamilyLocal, "/tmp/.X11-unix/X42", NULL, "42" }, + { "unix:42", FamilyLocal, "/tmp/.X11-unix/X42", NULL, "42" }, { "othermachine:23", FamilyWild, NULL, "othermachine", "23" }, { "bees.example.com:23", FamilyWild, NULL, "bees.example.com", "23" }, { "[::1]:0", FamilyInternet6, NULL, "::1", "0" },