From 9fae66d7cdbba8fd68d835c23e2fd7739c185024 Mon Sep 17 00:00:00 2001 From: Agathe Porte Date: Sun, 12 Jul 2020 00:34:37 +0200 Subject: initial commit --- examples/current-theme.rs | 12 ++++++++++++ examples/list-themes.rs | 5 +++++ 2 files changed, 17 insertions(+) create mode 100644 examples/current-theme.rs create mode 100644 examples/list-themes.rs (limited to 'examples') diff --git a/examples/current-theme.rs b/examples/current-theme.rs new file mode 100644 index 0000000..f52d36d --- /dev/null +++ b/examples/current-theme.rs @@ -0,0 +1,12 @@ +use plymouth::Plymouthd; +use plymouth::Theme; + +fn main() { + let config = Plymouthd::default().expect("could not load default config file"); + println!("current theme is {:?}", config.current_theme()); + + if let Some(name) = config.current_theme() { + let theme = Theme::from_name(name).expect("could not load current theme"); + println!("theme details: {:?}", theme); + } +} diff --git a/examples/list-themes.rs b/examples/list-themes.rs new file mode 100644 index 0000000..d499cb8 --- /dev/null +++ b/examples/list-themes.rs @@ -0,0 +1,5 @@ +use plymouth::Theme; + +fn main() { + Theme::list().unwrap().for_each(|name| println!("{}: {:?}", name, Theme::from_name(&name))); +} -- cgit v1.2.3