From b02149e43b798899d980454a5b8f1adb8c575e25 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Tue, 21 Sep 2021 22:32:21 +0200 Subject: [PATCH] screen-share: Add option to start screen sharing on weston startup Currently the screen sharing has to be manually started after weston has started by pressing Ctrl+Alt+S on a keyboard. Add new bool config option to the screen-share section which permits starting the screen sharing of all outputs on weston start up. This is useful e.g. for doing screen mirroring between two devices over network. Signed-off-by: Marek Vasut --- compositor/screen-share.c | 9 +++++++++ man/weston.ini.man | 6 ++++++ weston.ini.in | 1 + 3 files changed, 16 insertions(+) diff --git a/compositor/screen-share.c b/compositor/screen-share.c index c8c40a3f..4db07276 100644 --- a/compositor/screen-share.c +++ b/compositor/screen-share.c @@ -1165,8 +1165,10 @@ wet_module_init(struct weston_compositor *compositor, int *argc, char *argv[]) { struct screen_share *ss; + struct weston_output *output; struct weston_config *config; struct weston_config_section *section; + bool start_on_startup = false; ss = zalloc(sizeof *ss); if (ss == NULL) @@ -1182,5 +1184,12 @@ wet_module_init(struct weston_compositor *compositor, weston_compositor_add_key_binding(compositor, KEY_S, MODIFIER_CTRL | MODIFIER_ALT, share_output_binding, ss); + + if (weston_config_section_get_bool(section, "start-on-startup", + &start_on_startup, false) == 0) { + wl_list_for_each(output, &compositor->output_list, link) + weston_output_share(output, ss->command); + } + return 0; } diff --git a/man/weston.ini.man b/man/weston.ini.man index 014a805e..3de49299 100644 --- a/man/weston.ini.man +++ b/man/weston.ini.man @@ -669,6 +669,12 @@ sets the path to the xserver to run (string). sets the command to start a fullscreen-shell server for screen sharing (string). .RE .RE +.TP 7 +.BI "start-on-startup=" "false" +If set to true, start screen sharing of all outputs available on Weston startup. +Set to false by default. +.RE +.RE .SH "AUTOLAUNCH SECTION" .TP 7 .BI "path=" "/usr/bin/echo" diff --git a/weston.ini.in b/weston.ini.in index 92ae569e..011b1942 100644 --- a/weston.ini.in +++ b/weston.ini.in @@ -79,6 +79,7 @@ path=@libexecdir@/weston-keyboard [screen-share] command=@bindir@/weston --backend=rdp-backend.so --shell=fullscreen-shell.so --no-clients-resize +#start-on-startup=false #[xwayland] #path=@bindir@/Xwayland