commit 668cb41cc84ced37e0e8ba4ab65b6ab6549edc6c
parent 0404951ea7dfd27ef1bbf1f2a5896063e7268116
Author: Divan Visagie <me@divanv.com>
Date: Sat, 28 Nov 2026 00:50:23 +0100
greeter: a no-window probe mode, to try the real system calls on a machine or a VM
What: PATINA_GREETER_PROBE=status prints what the real system reports to the setup (is there Wi-Fi,
the networks in range, the number of time zones and the current one, the host name, whether it is a
first run); zone:Europe/Stockholm, name:alices-laptop and wifi:SSID:PASSWORD make the change the
setup would make and print the result. No window, no greetd.
Why: the mock backend can show every screen but cannot show that timedated, hostnamed, NetworkManager
and polkit behave the way the code assumes. Run as root it checks the D-Bus calls; run as the
greetd user (runuser -u greetd) on a VM whose only account is locked it checks the polkit rules
too, which is how the setup's Wi-Fi step was tried (see the next commit).
It is a debugging aid in the same spirit as PATINA_GREETER_DEMO and PATINA_GREETER_MOCK, and listed
with them in --help. Nothing in the normal start-up changes.
Diffstat:
1 file changed, 34 insertions(+), 0 deletions(-)
diff --git a/greeter/src/main.rs b/greeter/src/main.rs
@@ -22,6 +22,7 @@ For trying the screens without greetd, on a mock whose password is `sectorf`:
PATINA_GREETER_SIZE=1280x800 a window of that size, not full screen
PATINA_GREETER_DEMO=... fills a screen in: login: typing, wrong, problem; setup: wifi, wifi-problem, clock, name, name-problem, filled, problem
PATINA_GREETER_SCREENSHOT=file.png saves the screen to a file and quits
+ PATINA_GREETER_PROBE=status|zone:Z|name:N|wifi:SSID:PW no window: asks the real system (for trying it)
PATINA_SKIN=name another skin";
fn main() -> eframe::Result {
@@ -41,6 +42,11 @@ fn main() -> eframe::Result {
}
}
+ // No window: what the real system answers, for trying the setup's calls on a machine or a VM.
+ if let Ok(what) = std::env::var("PATINA_GREETER_PROBE") {
+ return probe(&system::System::new(), &what);
+ }
+
let backend: Arc<dyn Backend> = match std::env::var("PATINA_GREETER_MOCK").as_deref() {
Ok("setup") => Arc::new(Mock::first_run()),
Ok(_) => Arc::new(Mock::with_users()),
@@ -76,6 +82,34 @@ fn main() -> eframe::Result {
}
/// `PATINA_GREETER_SIZE=1280x800`, for a window on a desktop while developing.
+/// `PATINA_GREETER_PROBE=...`: `status` prints what the real system reports; `zone:Europe/Stockholm`,
+/// `name:alices-laptop` and `wifi:SSID:PASSWORD` make the change the setup would make, as whoever runs
+/// this (so polkit's rules for the greeter user can be tried with `runuser -u greetd`).
+fn probe(system: &system::System, what: &str) -> eframe::Result {
+ match what.split_once(':') {
+ None => {
+ println!("wifi available: {}", system.wifi_available());
+ println!("networks: {:?}", system.wifi_networks());
+ let zones = system.timezones();
+ println!(
+ "time zones: {} (current {})",
+ zones.len(),
+ system.timezone()
+ );
+ println!("host name: {}", system.hostname());
+ println!("first run: {}", system.first_run());
+ }
+ Some(("zone", zone)) => println!("set zone: {:?}", system.set_timezone(zone)),
+ Some(("name", name)) => println!("set name: {:?}", system.set_hostname(name)),
+ Some(("wifi", rest)) => {
+ let (ssid, password) = rest.split_once(':').unwrap_or((rest, ""));
+ println!("join {ssid}: {:?}", system.wifi_connect(ssid, password));
+ }
+ Some((other, _)) => eprintln!("unknown probe {other}"),
+ }
+ Ok(())
+}
+
fn window_size() -> Option<[f32; 2]> {
let text = std::env::var("PATINA_GREETER_SIZE").ok()?;
let (w, h) = text.split_once('x')?;