labwc/include/common/spawn.h
Johan Malm c841a25acf 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
2024-04-14 13:05:25 +02:00

41 lines
1 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_SPAWN_H
#define LABWC_SPAWN_H
#include <sys/types.h>
/**
* spawn_primary_client - execute asynchronously
* @command: command to be executed
*/
pid_t spawn_primary_client(const char *command);
/**
* spawn_async_no_shell - execute asynchronously
* @command: command to be executed
*/
void spawn_async_no_shell(char const *command);
/**
* spawn_piped - execute asyncronously
* @command: command to be executed
* @pipe_fd: set to the read end of a pipe
* connected to stdout of the command
*
* Notes:
* The returned pid_t has to be waited for to
* not produce zombies and the pipe_fd has to
* be closed. spawn_piped_close() can be used
* to ensure both.
*/
pid_t spawn_piped(const char *command, int *pipe_fd);
/**
* spawn_piped_close - clean up a previous
* spawn_piped() process
* @pid: will be waitpid()'d for
* @pipe_fd: will be close()'d
*/
void spawn_piped_close(pid_t pid, int pipe_fd);
#endif /* LABWC_SPAWN_H */