You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.7 KiB
54 lines
1.7 KiB
3 years ago
|
// Copyright (C) 2022 Tassilo Horn <tsdh@gnu.org>
|
||
|
//
|
||
|
// This program is free software: you can redistribute it and/or modify it
|
||
|
// under the terms of the GNU General Public License as published by the Free
|
||
|
// Software Foundation, either version 3 of the License, or (at your option)
|
||
|
// any later version.
|
||
|
//
|
||
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||
|
// more details.
|
||
|
//
|
||
|
// You should have received a copy of the GNU General Public License along with
|
||
|
// this program. If not, see <https://www.gnu.org/licenses/>.
|
||
|
|
||
|
//! TOML configuration for swayrbar.
|
||
|
|
||
3 years ago
|
use crate::module::BarModuleFn;
|
||
3 years ago
|
use serde::{Deserialize, Serialize};
|
||
3 years ago
|
use std::collections::HashMap;
|
||
3 years ago
|
|
||
|
#[derive(Debug, Serialize, Deserialize)]
|
||
|
pub struct Config {
|
||
3 years ago
|
/// The status is refreshed every `refresh_interval` milliseconds.
|
||
|
pub refresh_interval: u64,
|
||
|
/// The list of modules to display in the given order, each one specified
|
||
|
/// as `"<module_type>/<instance>"`.
|
||
3 years ago
|
pub modules: Vec<String>,
|
||
|
pub module_configs: Vec<ModuleConfig>,
|
||
|
}
|
||
|
|
||
|
#[derive(Debug, Serialize, Deserialize)]
|
||
|
pub struct ModuleConfig {
|
||
3 years ago
|
pub name: String,
|
||
3 years ago
|
pub instance: String,
|
||
|
pub format: String,
|
||
|
pub html_escape: bool,
|
||
3 years ago
|
pub on_click: HashMap<String, Vec<String>>,
|
||
3 years ago
|
}
|
||
|
|
||
|
impl Default for Config {
|
||
|
fn default() -> Self {
|
||
|
Config {
|
||
3 years ago
|
refresh_interval: 1000,
|
||
3 years ago
|
modules: vec!["date/0".to_owned()],
|
||
3 years ago
|
module_configs: vec![
|
||
3 years ago
|
crate::module::date::BarModuleDate::default_config(
|
||
3 years ago
|
"0".to_owned(),
|
||
|
),
|
||
|
],
|
||
3 years ago
|
}
|
||
|
}
|
||
|
}
|