Expand description
A parser for Hyprland’s configuration files 🚀
§Example usage
ⓘ
use hyprparser::parse_config;
use std::{env, fs, path::Path};
let config_path = Path::new(&env::var("XDG_CONFIG_HOME").unwrap()).join("hypr/hyprland.conf");
let config_str = fs::read_to_string(&config_path).expect("Failed to read the file");
let mut parsed_config = parse_config(&config_str);
parsed_config.add_entry("decoration", "rounding = 10");
parsed_config.add_entry("decoration.blur", "enabled = true");
parsed_config.add_entry("decoration.blur", "size = 10");
parsed_config.add_entry_headless("$terminal", "kitty");
let updated_config_str = parsed_config.to_string();
fs::write(&config_path, updated_config_str).expect("Failed to write the file");
Structs§
- Core structure of the config
Functions§
- Automatically parse the whole configuration from str