git clone https://garage44.eu/jeroen/pinnacle.git.. /ui/src/sound.rs
//! The sound's volume as Settings keeps it: a percent in `/settings/volume`,
//! which the display server gives the kernel's mixer at start.
/// Where the volume is kept.
pub const VOLUME_PATH: &str = "system:/settings/volume";
/// The volume kept, when one is: a percent, 0 to 100.
pub fn kept() -> Option<u8> {
pinnacle_rt::fs::read_string(VOLUME_PATH)?
.trim()
.parse()
.ok()
.filter(|v| *v <= 100)
}
/// Keeps `percent` where [`kept`] finds it.
pub fn keep(percent: u8) -> bool {
pinnacle_rt::fs::write(VOLUME_PATH, alloc::format!("{percent}").as_bytes())
}