aboutsummaryrefslogtreecommitdiffstats
path: root/include/sway/config.h
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2017-11-18 11:22:02 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2017-11-18 11:22:02 -0500
commit733993a651c71f7e2198d505960d6bbd31e0e107 (patch)
treee51732c5872b624e73355f9e5b3f762101f3cd0d /include/sway/config.h
parentInitial (awful) pass on xdg shell support (diff)
downloadsway-733993a651c71f7e2198d505960d6bbd31e0e107.tar.gz
sway-733993a651c71f7e2198d505960d6bbd31e0e107.tar.zst
sway-733993a651c71f7e2198d505960d6bbd31e0e107.zip
Move everything to sway/old/
Diffstat (limited to 'include/sway/config.h')
-rw-r--r--include/sway/config.h406
1 files changed, 0 insertions, 406 deletions
diff --git a/include/sway/config.h b/include/sway/config.h
deleted file mode 100644
index a05d5ede..00000000
--- a/include/sway/config.h
+++ /dev/null
@@ -1,406 +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 */
20struct sway_variable {
21 char *name;
22 char *value;
23};
24
25/**
26 * A key binding and an associated command.
27 */
28struct 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 */
40struct sway_mouse_binding {
41 uint32_t button;
42 char *command;
43};
44
45/**
46 * A "mode" of keybindings created via the `mode` command.
47 */
48struct sway_mode {
49 char *name;
50 list_t *bindings;
51};
52
53/**
54 * libinput options for input devices
55 */
56struct input_config {
57 char *identifier;
58
59 int accel_profile;
60 int click_method;
61 int drag_lock;
62 int dwt;
63 int left_handed;
64 int middle_emulation;
65 int natural_scroll;
66 float pointer_accel;
67 int scroll_method;
68 int send_events;
69 int tap;
70
71 bool capturable;
72 struct wlc_geometry region;
73};
74
75/**
76 * Size and position configuration for a particular output.
77 *
78 * This is set via the `output` command.
79 */
80struct output_config {
81 char *name;
82 int enabled;
83 int width, height;
84 int x, y;
85 int scale;
86 char *background;
87 char *background_option;
88};
89
90/**
91 * Maps a workspace name to an output name.
92 *
93 * Set via `workspace <x> output <y>`
94 */
95struct workspace_output {
96 char *output;
97 char *workspace;
98};
99
100struct pid_workspace {
101 pid_t *pid;
102 char *workspace;
103 time_t *time_added;
104};
105
106struct bar_config {
107 /**
108 * One of "dock", "hide", "invisible"
109 *
110 * Always visible in dock mode. Visible only when modifier key is held in hide mode.
111 * Never visible in invisible mode.
112 */
113 char *mode;
114 /**
115 * One of "show" or "hide".
116 *
117 * In "show" mode, it will always be shown on top of the active workspace.
118 */
119 char *hidden_state;
120 /**
121 * Id name used to identify the bar through IPC.
122 *
123 * Defaults to bar-x, where x corresponds to the position of the
124 * embedding bar block in the config file (bar-0, bar-1, ...).
125 */
126 char *id;
127 uint32_t modifier;
128 list_t *outputs;
129 enum desktop_shell_panel_position position;
130 list_t *bindings;
131 char *status_command;
132 bool pango_markup;
133 char *swaybar_command;
134 char *font;
135 int height; // -1 not defined
136
137#ifdef ENABLE_TRAY
138 // Tray
139 char *tray_output;
140 char *icon_theme;
141 uint32_t tray_padding;
142 uint32_t activate_button;
143 uint32_t context_button;
144 uint32_t secondary_button;
145#endif
146
147 bool workspace_buttons;
148 bool wrap_scroll;
149 char *separator_symbol;
150 bool strip_workspace_numbers;
151 bool binding_mode_indicator;
152 bool verbose;
153 pid_t pid;
154 struct {
155 char *background;
156 char *statusline;
157 char *separator;
158 char *focused_background;
159 char *focused_statusline;
160 char *focused_separator;
161 char *focused_workspace_border;
162 char *focused_workspace_bg;
163 char *focused_workspace_text;
164 char *active_workspace_border;
165 char *active_workspace_bg;
166 char *active_workspace_text;
167 char *inactive_workspace_border;
168 char *inactive_workspace_bg;
169 char *inactive_workspace_text;
170 char *urgent_workspace_border;
171 char *urgent_workspace_bg;
172 char *urgent_workspace_text;
173 char *binding_mode_border;
174 char *binding_mode_bg;
175 char *binding_mode_text;
176 } colors;
177};
178
179struct border_colors {
180 uint32_t border;
181 uint32_t background;
182 uint32_t text;
183 uint32_t indicator;
184 uint32_t child_border;
185};
186
187enum edge_border_types {
188 E_NONE, /**< Don't hide edge borders */
189 E_VERTICAL, /**< hide vertical edge borders */
190 E_HORIZONTAL, /**< hide horizontal edge borders */
191 E_BOTH, /**< hide vertical and horizontal edge borders */
192 E_SMART /**< hide both if precisely one window is present in workspace */
193};
194
195enum command_context {
196 CONTEXT_CONFIG = 1,
197 CONTEXT_BINDING = 2,
198 CONTEXT_IPC = 4,
199 CONTEXT_CRITERIA = 8,
200 CONTEXT_ALL = 0xFFFFFFFF,
201};
202
203struct command_policy {
204 char *command;
205 uint32_t context;
206};
207
208enum secure_feature {
209 FEATURE_LOCK = 1,
210 FEATURE_PANEL = 2,
211 FEATURE_BACKGROUND = 4,
212 FEATURE_SCREENSHOT = 8,
213 FEATURE_FULLSCREEN = 16,
214 FEATURE_KEYBOARD = 32,
215 FEATURE_MOUSE = 64,
216};
217
218struct feature_policy {
219 char *program;
220 uint32_t features;
221};
222
223enum ipc_feature {
224 IPC_FEATURE_COMMAND = 1,
225 IPC_FEATURE_GET_WORKSPACES = 2,
226 IPC_FEATURE_GET_OUTPUTS = 4,
227 IPC_FEATURE_GET_TREE = 8,
228 IPC_FEATURE_GET_MARKS = 16,
229 IPC_FEATURE_GET_BAR_CONFIG = 32,
230 IPC_FEATURE_GET_VERSION = 64,
231 IPC_FEATURE_GET_INPUTS = 128,
232 IPC_FEATURE_EVENT_WORKSPACE = 256,
233 IPC_FEATURE_EVENT_OUTPUT = 512,
234 IPC_FEATURE_EVENT_MODE = 1024,
235 IPC_FEATURE_EVENT_WINDOW = 2048,
236 IPC_FEATURE_EVENT_BINDING = 4096,
237 IPC_FEATURE_EVENT_INPUT = 8192,
238 IPC_FEATURE_GET_CLIPBOARD = 16384,
239
240 IPC_FEATURE_ALL_COMMANDS = 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 16384,
241 IPC_FEATURE_ALL_EVENTS = 256 | 512 | 1024 | 2048 | 4096 | 8192,
242
243 IPC_FEATURE_ALL = IPC_FEATURE_ALL_COMMANDS | IPC_FEATURE_ALL_EVENTS,
244};
245
246struct ipc_policy {
247 char *program;
248 uint32_t features;
249};
250
251/**
252 * The configuration struct. The result of loading a config file.
253 */
254struct sway_config {
255 list_t *symbols;
256 list_t *modes;
257 list_t *bars;
258 list_t *cmd_queue;
259 list_t *workspace_outputs;
260 list_t *pid_workspaces;
261 list_t *output_configs;
262 list_t *input_configs;
263 list_t *criteria;
264 list_t *no_focus;
265 list_t *active_bar_modifiers;
266 struct sway_mode *current_mode;
267 struct bar_config *current_bar;
268 uint32_t floating_mod;
269 uint32_t dragging_key;
270 uint32_t resizing_key;
271 char *floating_scroll_up_cmd;
272 char *floating_scroll_down_cmd;
273 char *floating_scroll_left_cmd;
274 char *floating_scroll_right_cmd;
275 enum swayc_layouts default_orientation;
276 enum swayc_layouts default_layout;
277 char *font;
278 int font_height;
279
280 // Flags
281 bool focus_follows_mouse;
282 bool mouse_warping;
283 bool force_focus_wrapping;
284 bool active;
285 bool failed;
286 bool reloading;
287 bool reading;
288 bool auto_back_and_forth;
289 bool seamless_mouse;
290 bool show_marks;
291
292 bool edge_gaps;
293 bool smart_gaps;
294 int gaps_inner;
295 int gaps_outer;
296
297 list_t *config_chain;
298 const char *current_config;
299
300 enum swayc_border_types border;
301 enum swayc_border_types floating_border;
302 int border_thickness;
303 int floating_border_thickness;
304 enum edge_border_types hide_edge_borders;
305
306 // border colors
307 struct {
308 struct border_colors focused;
309 struct border_colors focused_inactive;
310 struct border_colors unfocused;
311 struct border_colors urgent;
312 struct border_colors placeholder;
313 uint32_t background;
314 } border_colors;
315
316 // floating view
317 int32_t floating_maximum_width;
318 int32_t floating_maximum_height;
319 int32_t floating_minimum_width;
320 int32_t floating_minimum_height;
321
322 // Security
323 list_t *command_policies;
324 list_t *feature_policies;
325 list_t *ipc_policies;
326};
327
328void pid_workspace_add(struct pid_workspace *pw);
329void free_pid_workspace(struct pid_workspace *pw);
330
331/**
332 * Loads the main config from the given path. is_active should be true when
333 * reloading the config.
334 */
335bool load_main_config(const char *path, bool is_active);
336
337/**
338 * Loads an included config. Can only be used after load_main_config.
339 */
340bool load_include_configs(const char *path, struct sway_config *config);
341
342/**
343 * Reads the config from the given FILE.
344 */
345bool read_config(FILE *file, struct sway_config *config);
346
347/**
348 * Free config struct
349 */
350void free_config(struct sway_config *config);
351/**
352 * Does variable replacement for a string based on the config's currently loaded variables.
353 */
354char *do_var_replacement(char *str);
355
356struct cmd_results *check_security_config();
357
358int input_identifier_cmp(const void *item, const void *data);
359void merge_input_config(struct input_config *dst, struct input_config *src);
360void apply_input_config(struct input_config *ic, struct libinput_device *dev);
361void free_input_config(struct input_config *ic);
362
363int output_name_cmp(const void *item, const void *data);
364void merge_output_config(struct output_config *dst, struct output_config *src);
365/** Sets up a WLC output handle based on a given output_config.
366 */
367void apply_output_config(struct output_config *oc, swayc_t *output);
368void free_output_config(struct output_config *oc);
369
370/**
371 * Updates the list of active bar modifiers
372 */
373void update_active_bar_modifiers(void);
374
375int workspace_output_cmp_workspace(const void *a, const void *b);
376
377int sway_binding_cmp(const void *a, const void *b);
378int sway_binding_cmp_qsort(const void *a, const void *b);
379int sway_binding_cmp_keys(const void *a, const void *b);
380void free_sway_binding(struct sway_binding *sb);
381struct sway_binding *sway_binding_dup(struct sway_binding *sb);
382
383int sway_mouse_binding_cmp(const void *a, const void *b);
384int sway_mouse_binding_cmp_qsort(const void *a, const void *b);
385int sway_mouse_binding_cmp_buttons(const void *a, const void *b);
386void free_sway_mouse_binding(struct sway_mouse_binding *smb);
387
388void load_swaybars();
389void terminate_swaybg(pid_t pid);
390
391/**
392 * Allocate and initialize default bar configuration.
393 */
394struct bar_config *default_bar_config(void);
395
396/**
397 * Global config singleton.
398 */
399extern struct sway_config *config;
400
401/**
402 * Config file currently being read.
403 */
404extern const char *current_config_path;
405
406#endif