config: Remove default configuration
This commit is contained in:
@@ -81,16 +81,6 @@ pub struct Config {
|
|||||||
pub mode: OperationMode,
|
pub mode: OperationMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Config {
|
|
||||||
fn default() -> Config {
|
|
||||||
Config {
|
|
||||||
font_paths: None,
|
|
||||||
widget: Default::default(),
|
|
||||||
mode: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn generate_v1() -> Config {
|
pub fn generate_v1() -> Config {
|
||||||
let has_battery = Battery::detect();
|
let has_battery = Battery::detect();
|
||||||
@@ -264,68 +254,6 @@ fn leak_or_default(v: Option<String>, d: &'static str) -> &'static str {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Widget {
|
|
||||||
fn default() -> Widget {
|
|
||||||
Widget::VerticalLayout(vec![
|
|
||||||
Widget::HorizontalLayout(vec![
|
|
||||||
Widget::Clock {
|
|
||||||
font: None,
|
|
||||||
font_size: 128.,
|
|
||||||
},
|
|
||||||
Widget::Margin {
|
|
||||||
margins: (16, 16, 0, 0),
|
|
||||||
widget: Box::new(Widget::Date {
|
|
||||||
font: None,
|
|
||||||
font_size: 48.,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
Widget::VerticalLayout(vec![
|
|
||||||
Widget::Margin {
|
|
||||||
margins: (16, 8, 8, 0),
|
|
||||||
widget: Box::new(Widget::Battery {
|
|
||||||
font: None,
|
|
||||||
font_size: 24.,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
Widget::Margin {
|
|
||||||
margins: (16, 8, 8, 0),
|
|
||||||
widget: Box::new(Widget::Backlight {
|
|
||||||
device: None,
|
|
||||||
font: None,
|
|
||||||
font_size: 24.,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
Widget::Margin {
|
|
||||||
margins: (16, 8, 8, 0),
|
|
||||||
widget: Box::new(Widget::PulseAudio {
|
|
||||||
font: None,
|
|
||||||
font_size: 24.,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
]),
|
|
||||||
Widget::HorizontalLine(1),
|
|
||||||
Widget::InvertedHorizontalLayout(vec![
|
|
||||||
Widget::Margin {
|
|
||||||
margins: (16, 8, 16, 0),
|
|
||||||
widget: Box::new(Widget::Calendar {
|
|
||||||
font_primary: None,
|
|
||||||
font_secondary: None,
|
|
||||||
font_size: 24.,
|
|
||||||
sections_x: 1,
|
|
||||||
sections_y: -1,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
Widget::VerticalLine(1),
|
|
||||||
Widget::Launcher {
|
|
||||||
font: None,
|
|
||||||
font_size: 32.,
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
pub fn construct_widgets(
|
pub fn construct_widgets(
|
||||||
self,
|
self,
|
||||||
|
|||||||
+1
-1
@@ -129,7 +129,7 @@ fn main() {
|
|||||||
let home = env::var_os("HOME").unwrap().into_string().unwrap();
|
let home = env::var_os("HOME").unwrap().into_string().unwrap();
|
||||||
let config: Config = match File::open(format!("{}/.config/wldash/config.yml", home)) {
|
let config: Config = match File::open(format!("{}/.config/wldash/config.yml", home)) {
|
||||||
Ok(f) => serde_yaml::from_reader(f).unwrap(),
|
Ok(f) => serde_yaml::from_reader(f).unwrap(),
|
||||||
Err(_) => Default::default(),
|
Err(_) => panic!("configuration file missing"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(font_paths) = config.font_paths {
|
if let Some(font_paths) = config.font_paths {
|
||||||
|
|||||||
Reference in New Issue
Block a user