iwaku config changes, load changes, hypr support only IF passed the same as zshell
This commit is contained in:
+6
-25
@@ -5,11 +5,12 @@ use std::path::PathBuf;
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Config {
|
||||
#[serde(rename = "screenshot")]
|
||||
pub effects: EffectsConfig,
|
||||
pub screenshot: EffectsConfig,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct EffectsConfig {
|
||||
pub mode: String,
|
||||
pub rounded_corners: bool,
|
||||
pub corner_radius: f32,
|
||||
pub drop_shadow: bool,
|
||||
@@ -19,28 +20,6 @@ pub struct EffectsConfig {
|
||||
pub shadow_color: [u8; 4],
|
||||
}
|
||||
|
||||
impl Default for EffectsConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
rounded_corners: false,
|
||||
corner_radius: 12.0,
|
||||
drop_shadow: false,
|
||||
shadow_blur_radius: 20.0,
|
||||
shadow_offset_x: 5.0,
|
||||
shadow_offset_y: 8.0,
|
||||
shadow_color: [0, 0, 0, 160],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
effects: EffectsConfig::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn config_path() -> Option<PathBuf> {
|
||||
let home = std::env::var("HOME").ok()?;
|
||||
@@ -54,10 +33,12 @@ impl Config {
|
||||
|
||||
pub fn load() -> Result<Self> {
|
||||
let path = Self::config_path().context("Could not determine HOME directory")?;
|
||||
Self::load_from(&path)
|
||||
}
|
||||
|
||||
let raw = std::fs::read_to_string(&path)
|
||||
pub fn load_from(path: &PathBuf) -> Result<Self> {
|
||||
let raw = std::fs::read_to_string(path)
|
||||
.with_context(|| format!("Failed to read config at {}", path.display()))?;
|
||||
|
||||
serde_json::from_str(&raw)
|
||||
.with_context(|| format!("Failed to parse JSON config at {}", path.display()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user