This commit is contained in:
2025-01-02 00:44:43 +00:00
parent 778392f729
commit 5718d8d772
2 changed files with 6 additions and 0 deletions

View File

@@ -13,8 +13,11 @@ pub struct Config {
pub layouts: Vec<Layout>, pub layouts: Vec<Layout>,
} }
/// A configured layout
pub struct Layout { pub struct Layout {
/// Layout name
pub name: String, pub name: String,
/// If true, automatically enableable
pub automatic: bool, pub automatic: bool,
/// Map of monitor name to OutputConfig /// Map of monitor name to OutputConfig
pub outputs: HashMap<String, OutputConfig>, pub outputs: HashMap<String, OutputConfig>,

View File

@@ -3,6 +3,9 @@ use std::io::Read;
use std::path::PathBuf; use std::path::PathBuf;
use crate::config::Monitor; use crate::config::Monitor;
// Determine if the lid id closed.
// Returns true if the lid is known to be closed.
// Returns false if the lid is known to be open, or if the lid state is not known.
pub fn is_lid_closed(monitor: &Monitor) -> bool { pub fn is_lid_closed(monitor: &Monitor) -> bool {
if let Some(lid) = &monitor.lid { if let Some(lid) = &monitor.lid {
is_acpi_closed(lid) is_acpi_closed(lid)