termusiclib/config/tui_overlay.rs
1/// The TUI Settings to use, with possible overwrite (like from CLI)
2#[derive(Debug, Clone, PartialEq, Default)]
3#[allow(clippy::module_name_repetitions)]
4pub struct TuiOverlay {
5 /// The saved TUI-Settings
6 pub settings: super::v2::tui::TuiSettings,
7
8 /// Disable TUI images (like cover-art) from being displayed in the terminal
9 ///
10 /// This option will not be saved to the config and prevent saving to the config value
11 ///
12 /// (disables ueberzug, sixel, iterm, kitty image displaying)
13 pub coverart_hidden_overwrite: Option<bool>,
14
15 /// Enable/Disable checking for cover support.
16 ///
17 /// If `false`, will treat as if no cover features are compiled-in.
18 pub cover_features: bool,
19}
20
21impl TuiOverlay {
22 /// Get whether the coverart should be hidden or not, either the overwrite if present, otherwise the config itself
23 ///
24 /// true => hidden
25 #[must_use]
26 pub fn get_coverart_hidden(&self) -> bool {
27 if let Some(overwrite) = self.coverart_hidden_overwrite {
28 overwrite
29 } else {
30 self.settings.coverart.hidden
31 }
32 }
33
34 /// Get whether cover features should be enabled or not, regardless if they are compiled-in or not.
35 #[must_use]
36 pub fn cover_features_enabled(&self) -> bool {
37 self.cover_features
38 }
39}