Skip to content

Commit

Permalink
launch: Let window manager deal with WAYLAND_DISPLAY
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelforney committed Nov 10, 2018
1 parent 93ef48f commit c0e9489
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 5 additions & 2 deletions example/wm.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,16 @@ quit(void *data, uint32_t time, uint32_t value, uint32_t state)
int
main(int argc, char *argv[])
{
display = wl_display_create();
const char *socket;

display = wl_display_create();
if (!display)
return EXIT_FAILURE;

if (wl_display_add_socket(display, NULL) != 0)
socket = wl_display_add_socket_auto(display);
if (!socket)
return EXIT_FAILURE;
setenv("WAYLAND_DISPLAY", socket, 1);

if (!swc_initialize(display, NULL, &manager))
return EXIT_FAILURE;
Expand Down
7 changes: 2 additions & 5 deletions launch/launch.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ die(const char *format, ...);

static void __attribute__((noreturn)) usage(const char *name)
{
fprintf(stderr, "usage: %s [-n] [-s socket] [-t tty] [--] server [args...]\n", name);
fprintf(stderr, "usage: %s [-n] [-t tty] [--] server [args...]\n", name);
exit(2);
}

Expand Down Expand Up @@ -431,14 +431,11 @@ main(int argc, char *argv[])
sigset_t set;
posix_spawnattr_t attr;

while ((option = getopt(argc, argv, "ns:t:")) != -1) {
while ((option = getopt(argc, argv, "nt:")) != -1) {
switch (option) {
case 'n':
nflag = true;
break;
case 's':
setenv("WAYLAND_DISPLAY", optarg, true);
break;
case 't':
vt = optarg;
break;
Expand Down

0 comments on commit c0e9489

Please sign in to comment.