2023-01-25 04:14:49 +01:00
|
|
|
// Copyright 2023 System76 <info@system76.com>
|
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
|
|
|
|
|
|
#![allow(clippy::cast_precision_loss)]
|
|
|
|
|
#![allow(clippy::cast_sign_loss)]
|
|
|
|
|
#![allow(clippy::cast_possible_truncation)]
|
|
|
|
|
#![allow(clippy::cast_lossless)]
|
|
|
|
|
|
|
|
|
|
pub mod app;
|
|
|
|
|
pub use app::{Message, SettingsApp};
|
2023-01-27 03:10:54 +01:00
|
|
|
pub mod config;
|
|
|
|
|
|
2023-01-25 04:14:49 +01:00
|
|
|
#[macro_use]
|
|
|
|
|
pub mod localize;
|
2023-04-25 00:30:50 +02:00
|
|
|
pub mod pages;
|
2023-05-31 01:38:50 +02:00
|
|
|
pub mod theme;
|
|
|
|
|
pub mod widget;
|
2023-01-25 04:14:49 +01:00
|
|
|
|
2023-05-24 22:13:08 -04:00
|
|
|
use cosmic::{
|
|
|
|
|
iced::{wayland::actions::window::SctkWindowSettings, Application, Limits},
|
|
|
|
|
iced_sctk::settings::InitialSurface,
|
|
|
|
|
};
|
2023-01-25 04:14:49 +01:00
|
|
|
use i18n_embed::DesktopLanguageRequester;
|
|
|
|
|
|
|
|
|
|
/// # Errors
|
|
|
|
|
///
|
|
|
|
|
/// Returns error if iced fails to run the application.
|
2023-01-30 15:40:35 +01:00
|
|
|
pub fn main() -> color_eyre::Result<()> {
|
|
|
|
|
color_eyre::install()?;
|
|
|
|
|
|
|
|
|
|
if std::env::var("RUST_SPANTRACE").is_err() {
|
|
|
|
|
std::env::set_var("RUST_SPANTRACE", "0");
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-30 21:51:23 +02:00
|
|
|
if std::env::var_os("RUST_LOG").is_none() {
|
|
|
|
|
std::env::set_var("RUST_LOG", "info");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tracing_subscriber::fmt()
|
|
|
|
|
.pretty()
|
|
|
|
|
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
|
|
|
|
.with_writer(std::io::stderr)
|
|
|
|
|
.without_time()
|
|
|
|
|
.with_line_number(true)
|
|
|
|
|
.with_file(true)
|
|
|
|
|
.with_target(false)
|
|
|
|
|
.with_thread_names(true)
|
|
|
|
|
.init();
|
|
|
|
|
|
2023-01-25 04:14:49 +01:00
|
|
|
let localizer = crate::localize::localizer();
|
|
|
|
|
let requested_languages = DesktopLanguageRequester::requested_languages();
|
|
|
|
|
|
2023-05-22 17:26:14 +02:00
|
|
|
if let Err(why) = localizer.select(&requested_languages) {
|
|
|
|
|
tracing::error!(%why, "error while loading fluent localizations");
|
2023-01-25 04:14:49 +01:00
|
|
|
}
|
|
|
|
|
|
2023-04-25 00:30:50 +02:00
|
|
|
cosmic::settings::set_default_icon_theme("Pop");
|
|
|
|
|
let mut settings = cosmic::settings();
|
2023-05-24 22:13:08 -04:00
|
|
|
settings.initial_surface = InitialSurface::XdgWindow(SctkWindowSettings {
|
|
|
|
|
size_limits: Limits::NONE.min_width(600.0).min_height(300.0),
|
|
|
|
|
..Default::default()
|
|
|
|
|
});
|
|
|
|
|
|
2023-01-30 15:40:35 +01:00
|
|
|
SettingsApp::run(settings)?;
|
|
|
|
|
|
|
|
|
|
Ok(())
|
2023-01-25 04:14:49 +01:00
|
|
|
}
|