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 <daniels@collabora.com>
This commit is contained in:
Daniel Stone 2022-12-29 15:38:37 +00:00 committed by Marius Vlad
parent e7251a759b
commit 2c3693bf2e
6 changed files with 30 additions and 12 deletions

View File

@ -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 an existing Wayland or X11 session, it will start a 'nested' instance of Weston
inside a window in that session. 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 Help is available by running `weston --help`, or `man weston`, which will list
the available configuration options and display backends. It can also be 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 configured through a file on disk; more information on this can be found through

View File

@ -670,7 +670,7 @@ usage(int error_code)
#if defined(BUILD_X11_COMPOSITOR) #if defined(BUILD_X11_COMPOSITOR)
"\t\t\t\tx11\n" "\t\t\t\tx11\n"
#endif #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" " -S, --socket=NAME\tName of socket to listen on\n"
" -i, --idle-time=SECS\tIdle time in seconds\n" " -i, --idle-time=SECS\tIdle time in seconds\n"
#if defined(BUILD_XWAYLAND) #if defined(BUILD_XWAYLAND)
@ -922,12 +922,21 @@ wet_load_module(struct weston_compositor *compositor,
static int static int
wet_load_shell(struct weston_compositor *compositor, 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 (*shell_init)(struct weston_compositor *ec,
int *argc, char *argv[]); 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); shell_init = weston_load_module(name, "wet_shell_init", MODULEDIR);
free(name);
if (!shell_init) if (!shell_init)
return -1; return -1;
if (shell_init(compositor, argc, argv) < 0) 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) if (!shell)
weston_config_section_get_string(section, "shell", &shell, weston_config_section_get_string(section, "shell", &shell,
"desktop-shell.so"); "desktop");
if (wet_load_shell(wet.compositor, shell, &argc, argv) < 0) if (wet_load_shell(wet.compositor, shell, &argc, argv) < 0)
goto out; goto out;

View File

@ -96,7 +96,7 @@ The
.B core .B core
section is used to select the startup compositor modules and general options. section is used to select the startup compositor modules and general options.
.TP 7 .TP 7
.BI "shell=" desktop-shell.so .BI "shell=" desktop
specifies a shell to load (string). This can be used to load your own specifies a shell to load (string). This can be used to load your own
implemented shell or one with Weston as default. Available shells implemented shell or one with Weston as default. Available shells
in the in the
@ -105,7 +105,7 @@ directory are:
.PP .PP
.RS 10 .RS 10
.nf .nf
.BR desktop-shell.so .BR desktop
.fi .fi
.RE .RE
.TP 7 .TP 7
@ -660,7 +660,7 @@ sets the path to the xserver to run (string).
.SH "SCREEN-SHARE SECTION" .SH "SCREEN-SHARE SECTION"
.TP 7 .TP 7
.BI "command=" "@weston_bindir@/weston --backend=rdp \ .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). sets the command to start a fullscreen-shell server for screen sharing (string).
.TP 7 .TP 7
.BI "start-on-startup=" "false" .BI "start-on-startup=" "false"

View File

@ -188,6 +188,9 @@ Do not read
for the compositor. Avoids e.g. loading compositor modules via the for the compositor. Avoids e.g. loading compositor modules via the
configuration file, which is useful for unit tests. configuration file, which is useful for unit tests.
.TP .TP
\fB\-\-shell\fR=\fIshell\fR
Select which shell to load to provide Weston's user interface. See
.BR ENVIRONMENT "."
.TP .TP
\fB\-\^S\fR\fIname\fR, \fB\-\-socket\fR=\fIname\fR \fB\-\^S\fR\fIname\fR, \fB\-\-socket\fR=\fIname\fR
Weston will listen in the Wayland socket called Weston will listen in the Wayland socket called

View File

@ -248,10 +248,10 @@ static const char *
shell_to_str(enum shell_type t) shell_to_str(enum shell_type t)
{ {
static const char * const names[] = { static const char * const names[] = {
[SHELL_TEST_DESKTOP] = "weston-test-desktop-shell.so", [SHELL_TEST_DESKTOP] = "weston-test-desktop",
[SHELL_DESKTOP] = "desktop-shell.so", [SHELL_DESKTOP] = "desktop",
[SHELL_FULLSCREEN] = "fullscreen-shell.so", [SHELL_FULLSCREEN] = "fullscreen",
[SHELL_IVI] = "ivi-shell.so", [SHELL_IVI] = "ivi",
}; };
assert(t >= 0 && t < ARRAY_LENGTH(names)); assert(t >= 0 && t < ARRAY_LENGTH(names));
return names[t]; return names[t];

View File

@ -1,7 +1,7 @@
[core] [core]
#modules=cms-colord.so #modules=cms-colord.so
#xwayland=true #xwayland=true
#shell=desktop-shell.so #shell=desktop
#gbm-format=xrgb2101010 #gbm-format=xrgb2101010
#require-input=true #require-input=true
@ -82,7 +82,7 @@ path=@libexecdir@/weston-keyboard
#max_accel_factor = 1.0 #max_accel_factor = 1.0
[screen-share] [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 #start-on-startup=false
#[xwayland] #[xwayland]