Allow to opt-out from X11 session wrapping

While `startx` is a reasonable default, it might be missing from the
system or in confict with an already deployed solution for launching
X11 sessions.
`--no-xsession-wrapper` disables any modifications of the X11 session
commands.
This commit is contained in:
Aleksei Bavshin 2023-10-17 23:04:42 -07:00 committed by Antoine POPINEAU
parent 1690d71119
commit 2b119d9bd9
3 changed files with 9 additions and 1 deletions

View File

@ -17,6 +17,8 @@ Options:
--xsession-wrapper 'CMD [ARGS]...'
wrapper command to initialize X server and launch X11
sessions (default: startx /usr/bin/env)
--no-xsession-wrapper
do not wrap commands for X11 sessions
-w, --width WIDTH width of the main prompt (default: 80)
-i, --issue show the host's issue file
-g, --greeting GREETING

View File

@ -33,6 +33,9 @@ tuigreet - A graphical console greeter for greetd
By default, *startx /usr/bin/env* will be prepended to all X11 session
commands.
*--no-xsession-wrapper*
Do not wrap commands for X11 sessions.
*-w, --width COLS*
Number of columns the main prompt area should take on the screen.

View File

@ -297,6 +297,7 @@ impl Greeter {
opts.optopt("s", "sessions", "colon-separated list of Wayland session paths", "DIRS");
opts.optopt("x", "xsessions", "colon-separated list of X11 session paths", "DIRS");
opts.optopt("", "xsession-wrapper", xsession_wrapper_desc.as_str(), "'CMD [ARGS]...'");
opts.optflag("", "no-xsession-wrapper", "do not wrap commands for X11 sessions");
opts.optopt("w", "width", "width of the main prompt (default: 80)", "WIDTH");
opts.optflag("i", "issue", "show the host's issue file");
opts.optopt("g", "greeting", "show custom text above login prompt", "GREETING");
@ -409,7 +410,9 @@ impl Greeter {
self.session_paths.extend(env::split_paths(&dirs).map(|dir| (dir, SessionType::X11)));
}
self.xsession_wrapper = self.option("xsession-wrapper").or_else(|| Some(DEFAULT_XSESSION_WRAPPER.to_string()));
if !self.config().opt_present("no-xsession-wrapper") {
self.xsession_wrapper = self.option("xsession-wrapper").or_else(|| Some(DEFAULT_XSESSION_WRAPPER.to_string()));
}
if self.config().opt_present("issue") {
self.greeting = get_issue();