luminol_config/terminal/
mod.rs

1// Copyright (C) 2024 Melody Madeline Lyons
2//
3// This file is part of Luminol.
4//
5// Luminol is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Luminol is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Luminol.  If not, see <http://www.gnu.org/licenses/>.
17//
18//     Additional permission under GNU GPL version 3 section 7
19//
20// If you modify this Program, or any covered work, by linking or combining
21// it with Steamworks API by Valve Corporation, containing parts covered by
22// terms of the Steamworks API by Valve Corporation, the licensors of this
23// Program grant you additional permission to convey the resulting work.
24
25mod theme;
26pub use theme::Theme;
27
28#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)]
29pub struct Config {
30    pub font: egui::FontId,
31    pub initial_size: (u16, u16),
32    pub bell_enabled: bool,
33
34    pub cursor_blinking: CursorBlinking,
35    pub theme: Theme,
36}
37
38#[derive(serde::Serialize, serde::Deserialize)]
39#[derive(Clone, Copy, PartialEq, Eq, Debug)]
40#[derive(strum::EnumIter, strum::Display)]
41pub enum CursorBlinking {
42    #[strum(to_string = "Terminal defined")]
43    Terminal,
44    Always,
45    Never,
46}
47
48impl Default for Config {
49    fn default() -> Self {
50        Self {
51            font: Self::default_font(),
52            initial_size: (80, 24),
53            bell_enabled: true,
54            cursor_blinking: CursorBlinking::Always,
55            theme: Theme::default(),
56        }
57    }
58}
59
60impl Config {
61    pub fn default_font() -> egui::FontId {
62        egui::FontId {
63            size: 14.,
64            family: egui::FontFamily::Name("Iosevka Term".into()),
65        }
66    }
67}