1use crate::Modifier;
2use std::path::Path;
3
4#[derive(Debug, Clone, PartialEq)]
5pub struct Config {
6 pub windows: Option<Windows>,
7}
8
9impl Default for Config {
10 fn default() -> Self {
11 crate::io::Config::default()
12 .try_into()
13 .expect("the default config invalid")
14 }
15}
16
17#[derive(Debug, Clone, PartialEq)]
18pub struct Windows {
19 pub general: WindowsGeneral,
20 pub overview: Option<Overview>,
21 pub switch: Option<Switch>,
22 pub switch_2: Option<Switch>,
23}
24
25impl Default for Windows {
26 fn default() -> Self {
27 crate::io::Windows::default()
28 .try_into()
29 .expect("the default config invalid")
30 }
31}
32
33#[derive(Debug, Clone, PartialEq)]
34pub struct WindowsGeneral {
35 pub scale: f64,
36 pub items_per_row: u8,
37}
38
39#[derive(Debug, Clone, Eq, PartialEq)]
40pub struct Overview {
41 pub launcher: Launcher,
42 pub key: Box<str>,
43 pub top_offset: u16,
44 pub modifier: Modifier,
45 pub filter_by_same_class: bool,
46 pub filter_by_current_workspace: bool,
47 pub filter_by_current_monitor: bool,
48 pub exclude_workspaces: Box<str>,
49}
50
51impl Default for Overview {
52 fn default() -> Self {
53 crate::io::Overview::default()
54 .try_into()
55 .expect("the default config invalid")
56 }
57}
58
59#[derive(Debug, Clone, Eq, PartialEq)]
60pub struct Launcher {
61 pub default_terminal: Option<Box<str>>,
62 pub launch_modifier: Modifier,
63 pub alt_launch_modifier: Modifier,
64 pub width: u16,
65 pub max_items: u8,
66 pub show_when_empty: bool,
67 pub plugins: Plugins,
68}
69
70impl Default for Launcher {
71 fn default() -> Self {
72 crate::io::Launcher::default()
73 .try_into()
74 .expect("the default config invalid")
75 }
76}
77
78#[derive(Debug, Clone, Eq, PartialEq)]
79pub struct Plugins {
80 pub applications: Option<ApplicationsPluginConfig>,
81 pub terminal: Option<()>,
82 pub shell: Option<()>,
83 pub websearch: Option<WebSearchConfig>,
84 pub calc: Option<CalcPluginConfig>,
85 pub path: Option<()>,
86 pub actions: Option<ActionsPluginConfig>,
87}
88
89#[derive(Debug, Clone, Eq, PartialEq)]
90pub struct ActionsPluginConfig {
91 pub actions: Vec<ActionsPluginAction>,
92}
93
94impl Default for ActionsPluginConfig {
95 fn default() -> Self {
96 crate::io::ActionsPluginConfig::default()
97 .try_into()
98 .expect("the default config invalid")
99 }
100}
101
102#[derive(Debug, Clone, Eq, PartialEq)]
103pub struct ApplicationsPluginConfig {
104 pub run_cache_weeks: u8,
105 pub show_execs: bool,
106 pub show_actions_submenu: bool,
107}
108
109impl Default for ApplicationsPluginConfig {
110 fn default() -> Self {
111 crate::io::ApplicationsPluginConfig::default()
112 .try_into()
113 .expect("the default config invalid")
114 }
115}
116
117#[derive(Debug, Clone, Eq, PartialEq)]
118pub enum ActionsPluginAction {
119 LockScreen,
120 Logout,
121 Hibernate,
122 Reboot,
123 Shutdown,
124 Suspend,
125 Custom(ActionsPluginActionCustom),
126}
127
128#[derive(Debug, Clone, Eq, PartialEq)]
129pub struct ActionsPluginActionCustom {
130 pub names: Vec<Box<str>>,
131 pub details: Box<str>,
132 pub command: Box<str>,
133 pub icon: Box<Path>,
134}
135
136#[derive(Debug, Clone, Eq, PartialEq)]
137pub struct WebSearchConfig {
138 pub engines: Vec<SearchEngine>,
139}
140
141impl Default for WebSearchConfig {
142 fn default() -> Self {
143 crate::io::WebSearchConfig::default()
144 .try_into()
145 .expect("the default config invalid")
146 }
147}
148
149#[derive(Debug, Clone, Eq, PartialEq)]
150pub struct SearchEngine {
151 pub url: Box<str>,
152 pub name: Box<str>,
153 pub key: char,
154}
155
156#[derive(Debug, Clone, Eq, PartialEq)]
157pub struct CalcPluginConfig {
158 pub prefix: Option<String>,
159}
160
161impl Default for CalcPluginConfig {
162 fn default() -> Self {
163 crate::io::CalcPluginConfig::default()
164 .try_into()
165 .expect("the default config invalid")
166 }
167}
168
169#[derive(Debug, Clone, Eq, PartialEq)]
170pub struct Switch {
171 pub modifier: Modifier,
172 pub key: Box<str>,
173 pub filter_by_same_class: bool,
174 pub filter_by_current_workspace: bool,
175 pub filter_by_current_monitor: bool,
176 pub switch_workspaces: bool,
177 pub exclude_workspaces: Box<str>,
178 pub kill_key: char,
179}
180
181impl Default for Switch {
182 fn default() -> Self {
183 crate::io::Switch::default()
184 .try_into()
185 .expect("the default config invalid")
186 }
187}