| 1 | use serde::{Deserialize, Serialize}; |
| 2 | |
| 3 | use super::StringOrNum; |
| 4 | |
| 5 | #[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, PartialEq, Eq)] |
| 6 | #[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))] |
| 7 | #[serde(rename_all = "snake_case")] |
| 8 | pub enum TableGap { |
| 9 | None, |
| 10 | #[default] |
| 11 | Space, |
| 12 | Line, |
| 13 | } |
| 14 | |
| 15 | impl TableGap { |
| 16 | /// Returns the height in rows that this gap occupies. |
| 17 | pub const fn height(self) -> u16 { |
| 18 | match self { |
| 19 | Self::None => 0, |
| 20 | Self::Space | Self::Line => 1, |
| 21 | } |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | // TODO: Break this up. |
| 26 | #[derive(Clone, Debug, Default, Deserialize, Serialize)] |
| 27 | #[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))] |
| 28 | #[cfg_attr(test, serde(deny_unknown_fields), derive(PartialEq, Eq))] |
| 29 | pub(crate) struct GeneralConfig { |
| 30 | pub(crate) dot_marker: Option<bool>, |
| 31 | pub(crate) rate: Option<StringOrNum>, |
| 32 | pub(crate) basic: Option<bool>, |
| 33 | pub(crate) default_time_value: Option<StringOrNum>, |
| 34 | pub(crate) time_delta: Option<StringOrNum>, |
| 35 | pub(crate) autohide_time: Option<bool>, |
| 36 | pub(crate) hide_time: Option<bool>, |
| 37 | pub(crate) default_widget_type: Option<String>, |
| 38 | pub(crate) default_widget_count: Option<u64>, |
| 39 | pub(crate) expanded: Option<bool>, |
| 40 | pub(crate) use_old_network_legend: Option<bool>, |
| 41 | #[serde(default)] |
| 42 | pub(crate) table_gap: TableGap, |
| 43 | pub(crate) battery: Option<bool>, |
| 44 | pub(crate) disable_click: Option<bool>, |
| 45 | pub(crate) disable_keys: Option<bool>, |
| 46 | pub(crate) no_write: Option<bool>, |
| 47 | pub(crate) show_table_scroll_position: Option<bool>, |
| 48 | pub(crate) show_table_scroll_bar: Option<bool>, |
| 49 | pub(crate) read_only: Option<bool>, |
| 50 | pub(crate) disable_gpu: Option<bool>, |
| 51 | pub(crate) retention: Option<StringOrNum>, |
| 52 | pub(crate) temperature_type: Option<String>, |
| 53 | |
| 54 | // FIXME: Deprecate these in the future. |
| 55 | pub(crate) hide_avg_cpu: Option<bool>, |
| 56 | pub(crate) cpu_left_legend: Option<bool>, |
| 57 | pub(crate) average_cpu_row: Option<bool>, |
| 58 | pub(crate) enable_cache_memory: Option<bool>, |
| 59 | // #[cfg(feature = "zfs")] |
| 60 | pub(crate) free_arc: Option<bool>, |
| 61 | pub(crate) network_use_bytes: Option<bool>, |
| 62 | pub(crate) network_use_log: Option<bool>, |
| 63 | pub(crate) network_use_binary_prefix: Option<bool>, |
| 64 | pub(crate) network_legend: Option<String>, |
| 65 | pub(crate) memory_legend: Option<String>, |
| 66 | // #[cfg(target_os = "linux")] |
| 67 | pub(crate) hide_k_threads: Option<bool>, |
| 68 | pub(crate) tree_collapse: Option<bool>, |
| 69 | pub(crate) process_command: Option<bool>, |
| 70 | // This does nothing on Windows, but we leave it enabled to make the config file consistent |
| 71 | // across platforms. |
| 72 | // |
| 73 | // #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))] |
| 74 | pub(crate) disable_advanced_kill: Option<bool>, |
| 75 | pub(crate) process_memory_as_value: Option<bool>, |
| 76 | pub(crate) group_processes: Option<bool>, |
| 77 | pub(crate) regex: Option<bool>, |
| 78 | pub(crate) case_sensitive: Option<bool>, |
| 79 | pub(crate) whole_word: Option<bool>, |
| 80 | pub(crate) tree: Option<bool>, |
| 81 | pub(crate) current_usage: Option<bool>, |
| 82 | pub(crate) unnormalized_cpu: Option<bool>, |
| 83 | } |