mirror of
https://github.com/labwc/labwc.git
synced 2025-11-30 06:59:52 -05:00
Add -S|--session <command> option
...to start <command> on startup and to terminate the compositor when <command> exits. This is useful for session management as it allows the session client (for example `lxqt-session`) to terminate labwc - be exiting itself. Under X, xinit starts the server and keeps it alive for as long as lxqt-session runs. Thus either the session client starts the Window Manager, or the Window Manager can be launched independently first. On Wayland, the Compositor is both Display Server and Window Manager, so the described session management mechanisms do not work because the Compositor needs to be running before the session can function. As some session clients support both X11 and Wayland, this command line option avoids re-writes and fragmentation. Co-authored-by: @Consolatis
This commit is contained in:
parent
55138dbe0e
commit
c841a25acf
6 changed files with 95 additions and 5 deletions
10
src/server.c
10
src/server.c
|
|
@ -90,6 +90,7 @@ handle_sigchld(int signal, void *data)
|
|||
{
|
||||
siginfo_t info;
|
||||
info.si_pid = 0;
|
||||
struct server *server = data;
|
||||
|
||||
/* First call waitid() with NOWAIT which doesn't consume the zombie */
|
||||
if (waitid(P_ALL, /*id*/ 0, &info, WEXITED | WNOHANG | WNOWAIT) == -1) {
|
||||
|
|
@ -102,8 +103,7 @@ handle_sigchld(int signal, void *data)
|
|||
}
|
||||
|
||||
#if HAVE_XWAYLAND
|
||||
/* Verify that we do not break xwayland lazy initialization */
|
||||
struct server *server = data;
|
||||
/* Ensure that we do not break xwayland lazy initialization */
|
||||
if (server->xwayland && server->xwayland->server
|
||||
&& info.si_pid == server->xwayland->server->pid) {
|
||||
return 0;
|
||||
|
|
@ -139,6 +139,11 @@ handle_sigchld(int signal, void *data)
|
|||
" please report", (long)info.si_pid, info.si_code);
|
||||
}
|
||||
|
||||
if (info.si_pid == server->primary_client_pid) {
|
||||
wlr_log(WLR_INFO, "primary client %ld exited", (long)info.si_pid);
|
||||
wl_display_terminate(server->wl_display);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -290,6 +295,7 @@ get_headless_backend(struct wlr_backend *backend, void *data)
|
|||
void
|
||||
server_init(struct server *server)
|
||||
{
|
||||
server->primary_client_pid = -1;
|
||||
server->wl_display = wl_display_create();
|
||||
if (!server->wl_display) {
|
||||
wlr_log(WLR_ERROR, "cannot allocate a wayland display");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue