char *term;
char **argv;
+ char *seat;
};
int kmscon_pty_new(struct kmscon_pty **out, kmscon_pty_input_cb input_cb,
return 0;
}
+int kmscon_pty_set_seat(struct kmscon_pty *pty, const char *seat)
+{
+ char *t;
+
+ if (!pty || !seat)
+ return -EINVAL;
+
+ t = strdup(seat);
+ if (!t)
+ return -ENOMEM;
+ free(pty->seat);
+ pty->seat = t;
+
+ return 0;
+}
+
int kmscon_pty_get_fd(struct kmscon_pty *pty)
{
if (!pty)
}
static void __attribute__((noreturn))
-exec_child(int pty_master, const char *term, char **argv)
+exec_child(int pty_master, const char *term, char **argv, const char *seat)
{
if (!term)
term = "vt220";
argv = (char*[]){ "/bin/sh", "-l", NULL };
setenv("TERM", term, 1);
+ if (seat)
+ setenv("XDG_SEAT", seat, 1);
execvp(argv[0], argv);
log_err("failed to exec child %s: %m", argv[0]);
return -errno;
case 0:
setup_child(master, &ws);
- exec_child(pty->fd, pty->term, pty->argv);
+ exec_child(pty->fd, pty->term, pty->argv, pty->seat);
exit(EXIT_FAILURE);
default:
pty->fd = master;
void kmscon_pty_unref(struct kmscon_pty *pty);
int kmscon_pty_set_term(struct kmscon_pty *pty, const char *term);
int kmscon_pty_set_argv(struct kmscon_pty *pty, char **argv);
+int kmscon_pty_set_seat(struct kmscon_pty *pty, const char *seat);
int kmscon_pty_get_fd(struct kmscon_pty *pty);
void kmscon_pty_dispatch(struct kmscon_pty *pty);