// Copyright 2023 System76 // SPDX-License-Identifier: GPL-3.0-only use cosmic::{ app::{Application, Settings}, iced::Limits, }; use std::{path::PathBuf, process}; use app::{App, Flags}; mod app; pub mod clipboard; use config::Config; mod config; pub mod dialog; mod key_bind; mod localize; mod menu; mod mime_app; pub mod mime_icon; mod mounter; mod mouse_area; mod operation; mod spawn_detached; mod tab; pub fn home_dir() -> PathBuf { match dirs::home_dir() { Some(home) => home, None => { log::warn!("failed to locate home directory"); PathBuf::from("/") } } } /// Runs application with these settings #[rustfmt::skip] pub fn main() -> Result<(), Box> { #[cfg(all(unix, not(target_os = "redox")))] match fork::daemon(true, true) { Ok(fork::Fork::Child) => (), Ok(fork::Fork::Parent(_child_pid)) => process::exit(0), Err(err) => { eprintln!("failed to daemonize: {:?}", err); process::exit(1); } } env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("warn")).init(); localize::localize(); let (config_handler, config) = Config::load(); let mut settings = Settings::default(); settings = settings.theme(config.app_theme.theme()); settings = settings.size_limits(Limits::NONE.min_width(360.0).min_height(180.0)); settings = settings.exit_on_close(false); let flags = Flags { config_handler, config, }; cosmic::app::run::(settings, flags)?; Ok(()) }