Add command-line options (#342)
* feat: forward requested command-line options The CLI now forwards the `-ac`, `-audit`, `-auth`, `-core`, `+extension`, `-extension`, `-glamor`, `-listen`, `-nolisten`, and `-verbose` flags to `Xwayland`. In addition, command-line flags no longer require the display to be the first parameter. Also the `-help` and `-version` flags were added, which print the relevant message and return 0. The match case structure should make it easier to add new arguments if people have use for them. For example, I chose not to add the `-ld`, `-lm`, and `-ls` flags since they are dependent on `Xwayland`'s compile-time flags.
This commit is contained in:
parent
7af39ce419
commit
62bafcc3c9
3 changed files with 332 additions and 33 deletions
12
src/lib.rs
12
src/lib.rs
|
|
@ -36,6 +36,9 @@ type RealServerState = ServerState<RealConnection>;
|
|||
pub trait RunData {
|
||||
fn display(&self) -> Option<&str>;
|
||||
fn listenfds(&mut self) -> Vec<OwnedFd>;
|
||||
fn flags(&self) -> &[String] {
|
||||
&[]
|
||||
}
|
||||
fn server(&self) -> Option<UnixStream> {
|
||||
None
|
||||
}
|
||||
|
|
@ -58,12 +61,16 @@ pub const fn timespec_from_millis(millis: u64) -> Timespec {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn main(mut data: impl RunData) -> Option<()> {
|
||||
pub fn version() -> &'static str {
|
||||
let mut version = env!("VERGEN_GIT_DESCRIBE");
|
||||
if version == "VERGEN_IDEMPOTENT_OUTPUT" {
|
||||
version = env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
info!("Starting xwayland-satellite version {version}");
|
||||
version
|
||||
}
|
||||
|
||||
pub fn main(mut data: impl RunData) -> Option<()> {
|
||||
info!("Starting xwayland-satellite version {}", version());
|
||||
|
||||
let socket = ListeningSocket::bind_auto("xwls", 1..=128).unwrap();
|
||||
let mut display = Display::new().unwrap();
|
||||
|
|
@ -95,6 +102,7 @@ pub fn main(mut data: impl RunData) -> Option<()> {
|
|||
"-displayfd",
|
||||
&ready_tx.as_raw_fd().to_string(),
|
||||
])
|
||||
.args(data.flags())
|
||||
.env("WAYLAND_DISPLAY", socket.socket_name().unwrap())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue