Skip to content

Commit

Permalink
Allow to opt-out from X11 session wrapping
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alebastr authored and apognu committed Oct 21, 2023
1 parent 1690d71 commit 2b119d9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions contrib/man/tuigreet-1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
5 changes: 4 additions & 1 deletion src/greeter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 2b119d9

Please sign in to comment.