diff options
Diffstat (limited to 'include/config.h')
-rw-r--r-- | include/config.h | 320 |
1 files changed, 0 insertions, 320 deletions
diff --git a/include/config.h b/include/config.h deleted file mode 100644 index 56deaf01..00000000 --- a/include/config.h +++ /dev/null | |||
@@ -1,320 +0,0 @@ | |||
1 | #ifndef _SWAY_CONFIG_H | ||
2 | #define _SWAY_CONFIG_H | ||
3 | |||
4 | #define PID_WORKSPACE_TIMEOUT 60 | ||
5 | |||
6 | #include <libinput.h> | ||
7 | #include <stdint.h> | ||
8 | #include <wlc/geometry.h> | ||
9 | #include <wlc/wlc.h> | ||
10 | #include <xkbcommon/xkbcommon.h> | ||
11 | #include <time.h> | ||
12 | #include "wayland-desktop-shell-server-protocol.h" | ||
13 | #include "list.h" | ||
14 | #include "layout.h" | ||
15 | #include "container.h" | ||
16 | |||
17 | /** | ||
18 | * Describes a variable created via the `set` command. | ||
19 | */ | ||
20 | struct sway_variable { | ||
21 | char *name; | ||
22 | char *value; | ||
23 | }; | ||
24 | |||
25 | /** | ||
26 | * A key binding and an associated command. | ||
27 | */ | ||
28 | struct sway_binding { | ||
29 | int order; | ||
30 | bool release; | ||
31 | bool bindcode; | ||
32 | list_t *keys; | ||
33 | uint32_t modifiers; | ||
34 | char *command; | ||
35 | }; | ||
36 | |||
37 | /** | ||
38 | * A mouse binding and an associated command. | ||
39 | */ | ||
40 | struct sway_mouse_binding { | ||
41 | uint32_t button; | ||
42 | char *command; | ||
43 | }; | ||
44 | |||
45 | /** | ||
46 | * A "mode" of keybindings created via the `mode` command. | ||
47 | */ | ||
48 | struct sway_mode { | ||
49 | char *name; | ||
50 | list_t *bindings; | ||
51 | }; | ||
52 | |||
53 | /** | ||
54 | * libinput options for input devices | ||
55 | */ | ||
56 | struct input_config { | ||
57 | char *identifier; | ||
58 | |||
59 | int accel_profile; | ||
60 | int click_method; | ||
61 | int drag_lock; | ||
62 | int dwt; | ||
63 | int middle_emulation; | ||
64 | int natural_scroll; | ||
65 | float pointer_accel; | ||
66 | int scroll_method; | ||
67 | int send_events; | ||
68 | int tap; | ||
69 | |||
70 | bool capturable; | ||
71 | struct wlc_geometry region; | ||
72 | }; | ||
73 | |||
74 | /** | ||
75 | * Size and position configuration for a particular output. | ||
76 | * | ||
77 | * This is set via the `output` command. | ||
78 | */ | ||
79 | struct output_config { | ||
80 | char *name; | ||
81 | int enabled; | ||
82 | int width, height; | ||
83 | int x, y; | ||
84 | int scale; | ||
85 | char *background; | ||
86 | char *background_option; | ||
87 | }; | ||
88 | |||
89 | /** | ||
90 | * Maps a workspace name to an output name. | ||
91 | * | ||
92 | * Set via `workspace <x> output <y>` | ||
93 | */ | ||
94 | struct workspace_output { | ||
95 | char *output; | ||
96 | char *workspace; | ||
97 | }; | ||
98 | |||
99 | struct pid_workspace { | ||
100 | pid_t *pid; | ||
101 | char *workspace; | ||
102 | time_t *time_added; | ||
103 | }; | ||
104 | |||
105 | void pid_workspace_add(struct pid_workspace *pw); | ||
106 | void free_pid_workspace(struct pid_workspace *pw); | ||
107 | |||
108 | struct bar_config { | ||
109 | /** | ||
110 | * One of "dock", "hide", "invisible" | ||
111 | * | ||
112 | * Always visible in dock mode. Visible only when modifier key is held in hide mode. | ||
113 | * Never visible in invisible mode. | ||
114 | */ | ||
115 | char *mode; | ||
116 | /** | ||
117 | * One of "show" or "hide". | ||
118 | * | ||
119 | * In "show" mode, it will always be shown on top of the active workspace. | ||
120 | */ | ||
121 | char *hidden_state; | ||
122 | /** | ||
123 | * Id name used to identify the bar through IPC. | ||
124 | * | ||
125 | * Defaults to bar-x, where x corresponds to the position of the | ||
126 | * embedding bar block in the config file (bar-0, bar-1, ...). | ||
127 | */ | ||
128 | char *id; | ||
129 | uint32_t modifier; | ||
130 | list_t *outputs; | ||
131 | enum desktop_shell_panel_position position; | ||
132 | list_t *bindings; | ||
133 | char *status_command; | ||
134 | bool pango_markup; | ||
135 | char *swaybar_command; | ||
136 | char *font; | ||
137 | int height; // -1 not defined | ||
138 | int tray_padding; | ||
139 | bool workspace_buttons; | ||
140 | bool wrap_scroll; | ||
141 | char *separator_symbol; | ||
142 | bool strip_workspace_numbers; | ||
143 | bool binding_mode_indicator; | ||
144 | bool verbose; | ||
145 | pid_t pid; | ||
146 | struct { | ||
147 | char background[10]; | ||
148 | char statusline[10]; | ||
149 | char separator[10]; | ||
150 | char focused_workspace_border[10]; | ||
151 | char focused_workspace_bg[10]; | ||
152 | char focused_workspace_text[10]; | ||
153 | char active_workspace_border[10]; | ||
154 | char active_workspace_bg[10]; | ||
155 | char active_workspace_text[10]; | ||
156 | char inactive_workspace_border[10]; | ||
157 | char inactive_workspace_bg[10]; | ||
158 | char inactive_workspace_text[10]; | ||
159 | char urgent_workspace_border[10]; | ||
160 | char urgent_workspace_bg[10]; | ||
161 | char urgent_workspace_text[10]; | ||
162 | char binding_mode_border[10]; | ||
163 | char binding_mode_bg[10]; | ||
164 | char binding_mode_text[10]; | ||
165 | } colors; | ||
166 | }; | ||
167 | |||
168 | struct border_colors { | ||
169 | uint32_t border; | ||
170 | uint32_t background; | ||
171 | uint32_t text; | ||
172 | uint32_t indicator; | ||
173 | uint32_t child_border; | ||
174 | }; | ||
175 | |||
176 | enum edge_border_types { | ||
177 | E_NONE, /**< Don't hide edge borders */ | ||
178 | E_VERTICAL, /**< hide vertical edge borders */ | ||
179 | E_HORIZONTAL, /**< hide horizontal edge borders */ | ||
180 | E_BOTH /**< hide vertical and horizontal edge borders */ | ||
181 | }; | ||
182 | |||
183 | /** | ||
184 | * The configuration struct. The result of loading a config file. | ||
185 | */ | ||
186 | struct sway_config { | ||
187 | list_t *symbols; | ||
188 | list_t *modes; | ||
189 | list_t *bars; | ||
190 | list_t *cmd_queue; | ||
191 | list_t *workspace_outputs; | ||
192 | list_t *pid_workspaces; | ||
193 | list_t *output_configs; | ||
194 | list_t *input_configs; | ||
195 | list_t *criteria; | ||
196 | list_t *active_bar_modifiers; | ||
197 | struct sway_mode *current_mode; | ||
198 | struct bar_config *current_bar; | ||
199 | uint32_t floating_mod; | ||
200 | uint32_t dragging_key; | ||
201 | uint32_t resizing_key; | ||
202 | char *floating_scroll_up_cmd; | ||
203 | char *floating_scroll_down_cmd; | ||
204 | char *floating_scroll_left_cmd; | ||
205 | char *floating_scroll_right_cmd; | ||
206 | enum swayc_layouts default_orientation; | ||
207 | enum swayc_layouts default_layout; | ||
208 | char *font; | ||
209 | int font_height; | ||
210 | |||
211 | // Flags | ||
212 | bool focus_follows_mouse; | ||
213 | bool mouse_warping; | ||
214 | bool active; | ||
215 | bool failed; | ||
216 | bool reloading; | ||
217 | bool reading; | ||
218 | bool auto_back_and_forth; | ||
219 | bool seamless_mouse; | ||
220 | |||
221 | bool edge_gaps; | ||
222 | bool smart_gaps; | ||
223 | int gaps_inner; | ||
224 | int gaps_outer; | ||
225 | |||
226 | list_t *config_chain; | ||
227 | const char *current_config; | ||
228 | |||
229 | enum swayc_border_types border; | ||
230 | enum swayc_border_types floating_border; | ||
231 | int border_thickness; | ||
232 | int floating_border_thickness; | ||
233 | enum edge_border_types hide_edge_borders; | ||
234 | |||
235 | // border colors | ||
236 | struct { | ||
237 | struct border_colors focused; | ||
238 | struct border_colors focused_inactive; | ||
239 | struct border_colors unfocused; | ||
240 | struct border_colors urgent; | ||
241 | struct border_colors placeholder; | ||
242 | uint32_t background; | ||
243 | } border_colors; | ||
244 | |||
245 | // floating view | ||
246 | int32_t floating_maximum_width; | ||
247 | int32_t floating_maximum_height; | ||
248 | int32_t floating_minimum_width; | ||
249 | int32_t floating_minimum_height; | ||
250 | }; | ||
251 | |||
252 | /** | ||
253 | * Loads the main config from the given path. is_active should be true when | ||
254 | * reloading the config. | ||
255 | */ | ||
256 | bool load_main_config(const char *path, bool is_active); | ||
257 | |||
258 | /** | ||
259 | * Loads an included config. Can only be used after load_main_config. | ||
260 | */ | ||
261 | bool load_include_configs(const char *path, struct sway_config *config); | ||
262 | |||
263 | /** | ||
264 | * Reads the config from the given FILE. | ||
265 | */ | ||
266 | bool read_config(FILE *file, struct sway_config *config); | ||
267 | |||
268 | /** | ||
269 | * Free config struct | ||
270 | */ | ||
271 | void free_config(struct sway_config *config); | ||
272 | /** | ||
273 | * Does variable replacement for a string based on the config's currently loaded variables. | ||
274 | */ | ||
275 | char *do_var_replacement(char *str); | ||
276 | |||
277 | int input_identifier_cmp(const void *item, const void *data); | ||
278 | void merge_input_config(struct input_config *dst, struct input_config *src); | ||
279 | void apply_input_config(struct input_config *ic, struct libinput_device *dev); | ||
280 | void free_input_config(struct input_config *ic); | ||
281 | |||
282 | int output_name_cmp(const void *item, const void *data); | ||
283 | void merge_output_config(struct output_config *dst, struct output_config *src); | ||
284 | /** Sets up a WLC output handle based on a given output_config. | ||
285 | */ | ||
286 | void apply_output_config(struct output_config *oc, swayc_t *output); | ||
287 | void free_output_config(struct output_config *oc); | ||
288 | |||
289 | /** | ||
290 | * Updates the list of active bar modifiers | ||
291 | */ | ||
292 | void update_active_bar_modifiers(void); | ||
293 | |||
294 | int workspace_output_cmp_workspace(const void *a, const void *b); | ||
295 | |||
296 | int sway_binding_cmp(const void *a, const void *b); | ||
297 | int sway_binding_cmp_qsort(const void *a, const void *b); | ||
298 | int sway_binding_cmp_keys(const void *a, const void *b); | ||
299 | void free_sway_binding(struct sway_binding *sb); | ||
300 | struct sway_binding *sway_binding_dup(struct sway_binding *sb); | ||
301 | |||
302 | int sway_mouse_binding_cmp(const void *a, const void *b); | ||
303 | int sway_mouse_binding_cmp_qsort(const void *a, const void *b); | ||
304 | int sway_mouse_binding_cmp_buttons(const void *a, const void *b); | ||
305 | void free_sway_mouse_binding(struct sway_mouse_binding *smb); | ||
306 | |||
307 | void load_swaybars(); | ||
308 | void terminate_swaybg(pid_t pid); | ||
309 | |||
310 | /** | ||
311 | * Allocate and initialize default bar configuration. | ||
312 | */ | ||
313 | struct bar_config *default_bar_config(void); | ||
314 | |||
315 | /** | ||
316 | * Global config singleton. | ||
317 | */ | ||
318 | extern struct sway_config *config; | ||
319 | |||
320 | #endif | ||