From 2c3693bf2e05b5b4e712ac5b4b352efc7b50d85b Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Thu, 29 Dec 2022 15:38:37 +0000 Subject: [PATCH] frontend: Use short-form names for shell argument Instead of passing --shell=foo-shell.so, just pass --shell=foo, whilst accepting the old form for compatibility. Whilst we're at it, document the --shell argument in the manpage and README. Signed-off-by: Daniel Stone --- README.md | 6 ++++++ compositor/main.c | 15 ++++++++++++--- man/weston.ini.man | 6 +++--- man/weston.man | 3 +++ tests/weston-test-fixture-compositor.c | 8 ++++---- weston.ini.in | 4 ++-- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 62ea67257..9a93434e2 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,12 @@ from a text console, it will take over that console. When launched from inside an existing Wayland or X11 session, it will start a 'nested' instance of Weston inside a window in that session. +By default, Weston will start with a skeletal desktop-like environment called +`desktop-shell`. Other shells are available; for example, to load the `kiosk` +shell designed for single-application environments, you can start with: + + $ weston --shell=kiosk + Help is available by running `weston --help`, or `man weston`, which will list the available configuration options and display backends. It can also be configured through a file on disk; more information on this can be found through diff --git a/compositor/main.c b/compositor/main.c index c31dccf8b..6f0c4fbe9 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -670,7 +670,7 @@ usage(int error_code) #if defined(BUILD_X11_COMPOSITOR) "\t\t\t\tx11\n" #endif - " --shell=MODULE\tShell module, defaults to desktop-shell.so\n" + " --shell=NAME\tShell to load, defaults to desktop\n" " -S, --socket=NAME\tName of socket to listen on\n" " -i, --idle-time=SECS\tIdle time in seconds\n" #if defined(BUILD_XWAYLAND) @@ -922,12 +922,21 @@ wet_load_module(struct weston_compositor *compositor, static int wet_load_shell(struct weston_compositor *compositor, - const char *name, int *argc, char *argv[]) + const char *_name, int *argc, char *argv[]) { + char *name; int (*shell_init)(struct weston_compositor *ec, int *argc, char *argv[]); + if (strstr(_name, "-shell.so")) + name = strdup(_name); + else + str_printf(&name, "%s-shell.so", _name); + assert(name); + shell_init = weston_load_module(name, "wet_shell_init", MODULEDIR); + free(name); + if (!shell_init) return -1; if (shell_init(compositor, argc, argv) < 0) @@ -3893,7 +3902,7 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data) if (!shell) weston_config_section_get_string(section, "shell", &shell, - "desktop-shell.so"); + "desktop"); if (wet_load_shell(wet.compositor, shell, &argc, argv) < 0) goto out; diff --git a/man/weston.ini.man b/man/weston.ini.man index 9dff1d469..e410703b0 100644 --- a/man/weston.ini.man +++ b/man/weston.ini.man @@ -96,7 +96,7 @@ The .B core section is used to select the startup compositor modules and general options. .TP 7 -.BI "shell=" desktop-shell.so +.BI "shell=" desktop specifies a shell to load (string). This can be used to load your own implemented shell or one with Weston as default. Available shells in the @@ -105,7 +105,7 @@ directory are: .PP .RS 10 .nf -.BR desktop-shell.so +.BR desktop .fi .RE .TP 7 @@ -660,7 +660,7 @@ sets the path to the xserver to run (string). .SH "SCREEN-SHARE SECTION" .TP 7 .BI "command=" "@weston_bindir@/weston --backend=rdp \ ---shell=fullscreen-shell.so --no-clients-resize --no-config" +--shell=fullscreen --no-clients-resize --no-config" sets the command to start a fullscreen-shell server for screen sharing (string). .TP 7 .BI "start-on-startup=" "false" diff --git a/man/weston.man b/man/weston.man index abf791528..52a7d1370 100644 --- a/man/weston.man +++ b/man/weston.man @@ -188,6 +188,9 @@ Do not read for the compositor. Avoids e.g. loading compositor modules via the configuration file, which is useful for unit tests. .TP +\fB\-\-shell\fR=\fIshell\fR +Select which shell to load to provide Weston's user interface. See +.BR ENVIRONMENT "." .TP \fB\-\^S\fR\fIname\fR, \fB\-\-socket\fR=\fIname\fR Weston will listen in the Wayland socket called diff --git a/tests/weston-test-fixture-compositor.c b/tests/weston-test-fixture-compositor.c index 64046c11e..6a6a05cba 100644 --- a/tests/weston-test-fixture-compositor.c +++ b/tests/weston-test-fixture-compositor.c @@ -248,10 +248,10 @@ static const char * shell_to_str(enum shell_type t) { static const char * const names[] = { - [SHELL_TEST_DESKTOP] = "weston-test-desktop-shell.so", - [SHELL_DESKTOP] = "desktop-shell.so", - [SHELL_FULLSCREEN] = "fullscreen-shell.so", - [SHELL_IVI] = "ivi-shell.so", + [SHELL_TEST_DESKTOP] = "weston-test-desktop", + [SHELL_DESKTOP] = "desktop", + [SHELL_FULLSCREEN] = "fullscreen", + [SHELL_IVI] = "ivi", }; assert(t >= 0 && t < ARRAY_LENGTH(names)); return names[t]; diff --git a/weston.ini.in b/weston.ini.in index e8ba78f4b..d3180ccec 100644 --- a/weston.ini.in +++ b/weston.ini.in @@ -1,7 +1,7 @@ [core] #modules=cms-colord.so #xwayland=true -#shell=desktop-shell.so +#shell=desktop #gbm-format=xrgb2101010 #require-input=true @@ -82,7 +82,7 @@ path=@libexecdir@/weston-keyboard #max_accel_factor = 1.0 [screen-share] -command=@bindir@/weston --backend=rdp --shell=fullscreen-shell.so --no-clients-resize +command=@bindir@/weston --backend=rdp --shell=fullscreen --no-clients-resize #start-on-startup=false #[xwayland]