fucking something i forgot
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
use clap::Parser;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Parser)]
|
||||
pub struct Args {
|
||||
#[arg(short, long)]
|
||||
pub config: PathBuf,
|
||||
// #[arg(long)]
|
||||
// demo: bool,
|
||||
}
|
||||
+21
-2
@@ -4,11 +4,17 @@
|
||||
//! `wlr-layer-shell`. Optional first CLI arg = target output name.
|
||||
//! Clicking a module's button spawns a LayerShell popup anchored to it.
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
|
||||
use clap::Parser;
|
||||
use common::BarbarConfig;
|
||||
use iced_layershell::daemon;
|
||||
use iced_layershell::reexport::Anchor;
|
||||
use iced_layershell::settings::{LayerShellSettings, Settings, StartMode};
|
||||
|
||||
mod app;
|
||||
mod args;
|
||||
mod msg;
|
||||
mod popup;
|
||||
mod subscription;
|
||||
@@ -22,8 +28,21 @@ pub(crate) use msg::{Message, Msg};
|
||||
const BAR_HEIGHT: u32 = 36;
|
||||
|
||||
fn main() -> Result<(), iced_layershell::Error> {
|
||||
let start_mode = match std::env::args().nth(1) {
|
||||
Some(output) => StartMode::TargetScreen(output),
|
||||
let args = args::Args::parse();
|
||||
|
||||
let config_handle = File::open(args.config);
|
||||
let config: BarbarConfig;
|
||||
if let Ok(mut config_file) = config_handle {
|
||||
let mut string = String::new();
|
||||
config_file.read_to_string(&mut string).unwrap();
|
||||
config = toml::from_str(&string).unwrap();
|
||||
} else {
|
||||
println!("cant open config file");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let start_mode = match config.monitor {
|
||||
Some(x) => StartMode::TargetScreen(x),
|
||||
None => StartMode::Active,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user