login greeter
git clone https://git.lucas.co/cce-display-manager.git
feat: show build date on the display-manager interface
Add a build.rs that stamps CCE_BUILD_DATE at compile time and render it in the
bottom-right corner, so it's clear which build the greeter is running.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
build.rs | 16 ++++++++++++++++
src/main.rs | 14 ++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/build.rs b/build.rs
new file mode 100644
index 0000000..1b685a6
--- /dev/null
+++ b/build.rs
@@ -0,0 +1,16 @@
+use std::process::Command;
+
+fn main() {
+ // Capture the build date so the interface can show which build is running.
+ // With no rerun-if-changed pin, Cargo re-runs this whenever the crate's
+ // sources change, so CCE_BUILD_DATE tracks the last actual recompile.
+ let date = Command::new("date")
+ .arg("+%Y-%m-%d")
+ .output()
+ .ok()
+ .and_then(|o| String::from_utf8(o.stdout).ok())
+ .map(|s| s.trim().to_string())
+ .filter(|s| !s.is_empty())
+ .unwrap_or_else(|| "unknown".to_string());
+ println!("cargo:rustc-env=CCE_BUILD_DATE={}", date);
+}
diff --git a/src/main.rs b/src/main.rs
index 12de5b3..d9cd20a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -441,6 +441,20 @@ impl State {
bounds: None,
});
+ // Build-date stamp in the bottom-right corner.
+ let build_buf = make_text_buffer(
+ &mut self.font_system,
+ concat!("Built ", env!("CCE_BUILD_DATE")),
+ 11.0,
+ );
+ self.text_items.push(TextItem {
+ buffer: build_buf,
+ x: self.width - 130.0,
+ y: self.height - 24.0,
+ color: glyphon::Color::rgb(0x60, 0x60, 0x6e),
+ bounds: None,
+ });
+
let mut widget_labels = Vec::new();
for w in self.widgets_iter() {
widget_labels.extend(w.text_labels());