aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ipc.h1
-rw-r--r--include/list.h7
-rw-r--r--include/readline.h10
-rw-r--r--include/stringop.h8
-rw-r--r--include/sway/commands.h22
-rw-r--r--include/sway/config.h39
-rw-r--r--include/sway/input/cursor.h37
-rw-r--r--include/sway/input/input-manager.h10
-rw-r--r--include/sway/input/seat.h88
-rw-r--r--include/sway/output.h12
-rw-r--r--include/sway/tree/container.h8
-rw-r--r--include/sway/tree/view.h7
-rw-r--r--include/swaybar/bar.h14
-rw-r--r--include/swaybar/config.h18
-rw-r--r--include/swaybar/i3bar.h3
-rw-r--r--include/swaybar/input.h12
-rw-r--r--include/swaybar/tray/host.h17
-rw-r--r--include/swaybar/tray/icon.h52
-rw-r--r--include/swaybar/tray/item.h49
-rw-r--r--include/swaybar/tray/sni.h82
-rw-r--r--include/swaybar/tray/tray.h40
-rw-r--r--include/swaybar/tray/watcher.h18
-rw-r--r--include/swaylock/swaylock.h5
-rw-r--r--include/swaynag/swaynag.h1
24 files changed, 397 insertions, 163 deletions
diff --git a/include/ipc.h b/include/ipc.h
index 9063b933..6063f69c 100644
--- a/include/ipc.h
+++ b/include/ipc.h
@@ -16,6 +16,7 @@ enum ipc_command_type {
16 IPC_GET_BINDING_MODES = 8, 16 IPC_GET_BINDING_MODES = 8,
17 IPC_GET_CONFIG = 9, 17 IPC_GET_CONFIG = 9,
18 IPC_SEND_TICK = 10, 18 IPC_SEND_TICK = 10,
19 IPC_SYNC = 11,
19 20
20 // sway-specific command types 21 // sway-specific command types
21 IPC_GET_INPUTS = 100, 22 IPC_GET_INPUTS = 100,
diff --git a/include/list.h b/include/list.h
index 03851a82..895f6cc0 100644
--- a/include/list.h
+++ b/include/list.h
@@ -9,7 +9,6 @@ typedef struct {
9 9
10list_t *create_list(void); 10list_t *create_list(void);
11void list_free(list_t *list); 11void list_free(list_t *list);
12void list_foreach(list_t *list, void (*callback)(void* item));
13void list_add(list_t *list, void *item); 12void list_add(list_t *list, void *item);
14void list_insert(list_t *list, int index, void *item); 13void list_insert(list_t *list, int index, void *item);
15void list_del(list_t *list, int index); 14void list_del(list_t *list, int index);
@@ -27,4 +26,10 @@ void list_stable_sort(list_t *list, int compare(const void *a, const void *b));
27void list_swap(list_t *list, int src, int dest); 26void list_swap(list_t *list, int src, int dest);
28// move item to end of list 27// move item to end of list
29void list_move_to_end(list_t *list, void *item); 28void list_move_to_end(list_t *list, void *item);
29
30/* Calls `free` for each item in the list, then frees the list.
31 * Do not use this to free lists of primitives or items that require more
32 * complicated deallocation code.
33 */
34void list_free_items_and_destroy(list_t *list);
30#endif 35#endif
diff --git a/include/readline.h b/include/readline.h
deleted file mode 100644
index ee2eba5d..00000000
--- a/include/readline.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _SWAY_READLINE_H
2#define _SWAY_READLINE_H
3
4#include <stdio.h>
5
6char *read_line(FILE *file);
7char *peek_line(FILE *file, int line_offset, long *position);
8char *read_line_buffer(FILE *file, char *string, size_t string_len);
9
10#endif
diff --git a/include/stringop.h b/include/stringop.h
index 919e605c..f7ca60a5 100644
--- a/include/stringop.h
+++ b/include/stringop.h
@@ -3,10 +3,7 @@
3 3
4#include "list.h" 4#include "list.h"
5 5
6// array of whitespace characters to use for delims 6void strip_whitespace(char *str);
7extern const char whitespace[];
8
9char *strip_whitespace(char *str);
10char *strip_comments(char *str); 7char *strip_comments(char *str);
11void strip_quotes(char *str); 8void strip_quotes(char *str);
12 9
@@ -17,9 +14,8 @@ char *lenient_strncat(char *dest, const char *src, size_t len);
17// strcmp that also handles null pointers. 14// strcmp that also handles null pointers.
18int lenient_strcmp(char *a, char *b); 15int lenient_strcmp(char *a, char *b);
19 16
20// Simply split a string with delims, free with `free_flat_list` 17// Simply split a string with delims, free with `list_free_items_and_destroy`
21list_t *split_string(const char *str, const char *delims); 18list_t *split_string(const char *str, const char *delims);
22void free_flat_list(list_t *list);
23 19
24// Splits an argument string, keeping quotes intact 20// Splits an argument string, keeping quotes intact
25char **split_args(const char *str, int *argc); 21char **split_args(const char *str, int *argc);
diff --git a/include/sway/commands.h b/include/sway/commands.h
index 32925369..5d45d78b 100644
--- a/include/sway/commands.h
+++ b/include/sway/commands.h
@@ -56,7 +56,7 @@ struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers,
56 * all matching containers. Otherwise, it'll run on the `con` container. If 56 * all matching containers. Otherwise, it'll run on the `con` container. If
57 * `con` is NULL then it'll run on the currently focused container. 57 * `con` is NULL then it'll run on the currently focused container.
58 */ 58 */
59struct cmd_results *execute_command(char *command, struct sway_seat *seat, 59list_t *execute_command(char *command, struct sway_seat *seat,
60 struct sway_container *con); 60 struct sway_container *con);
61/** 61/**
62 * Parse and handles a command during config file loading. 62 * Parse and handles a command during config file loading.
@@ -82,11 +82,11 @@ struct cmd_results *cmd_results_new(enum cmd_status status, const char* input, c
82 */ 82 */
83void free_cmd_results(struct cmd_results *results); 83void free_cmd_results(struct cmd_results *results);
84/** 84/**
85 * Serializes cmd_results to a JSON string. 85 * Serializes a list of cmd_results to a JSON string.
86 * 86 *
87 * Free the JSON string later on. 87 * Free the JSON string later on.
88 */ 88 */
89char *cmd_results_to_json(struct cmd_results *results); 89char *cmd_results_to_json(list_t *res_list);
90 90
91struct cmd_results *add_color(const char *name, 91struct cmd_results *add_color(const char *name,
92 char *buffer, const char *color); 92 char *buffer, const char *color);
@@ -172,7 +172,11 @@ sway_cmd cmd_swaybg_command;
172sway_cmd cmd_swaynag_command; 172sway_cmd cmd_swaynag_command;
173sway_cmd cmd_swap; 173sway_cmd cmd_swap;
174sway_cmd cmd_tiling_drag; 174sway_cmd cmd_tiling_drag;
175sway_cmd cmd_tiling_drag_threshold;
176sway_cmd cmd_title_align;
175sway_cmd cmd_title_format; 177sway_cmd cmd_title_format;
178sway_cmd cmd_titlebar_border_thickness;
179sway_cmd cmd_titlebar_padding;
176sway_cmd cmd_unmark; 180sway_cmd cmd_unmark;
177sway_cmd cmd_urgent; 181sway_cmd cmd_urgent;
178sway_cmd cmd_workspace; 182sway_cmd cmd_workspace;
@@ -180,12 +184,12 @@ sway_cmd cmd_workspace_layout;
180sway_cmd cmd_ws_auto_back_and_forth; 184sway_cmd cmd_ws_auto_back_and_forth;
181sway_cmd cmd_xwayland; 185sway_cmd cmd_xwayland;
182 186
183sway_cmd bar_cmd_activate_button; 187sway_cmd bar_cmd_bindcode;
184sway_cmd bar_cmd_binding_mode_indicator; 188sway_cmd bar_cmd_binding_mode_indicator;
185sway_cmd bar_cmd_bindsym; 189sway_cmd bar_cmd_bindsym;
186sway_cmd bar_cmd_colors; 190sway_cmd bar_cmd_colors;
187sway_cmd bar_cmd_context_button;
188sway_cmd bar_cmd_font; 191sway_cmd bar_cmd_font;
192sway_cmd bar_cmd_gaps;
189sway_cmd bar_cmd_mode; 193sway_cmd bar_cmd_mode;
190sway_cmd bar_cmd_modifier; 194sway_cmd bar_cmd_modifier;
191sway_cmd bar_cmd_output; 195sway_cmd bar_cmd_output;
@@ -194,12 +198,15 @@ sway_cmd bar_cmd_hidden_state;
194sway_cmd bar_cmd_icon_theme; 198sway_cmd bar_cmd_icon_theme;
195sway_cmd bar_cmd_id; 199sway_cmd bar_cmd_id;
196sway_cmd bar_cmd_position; 200sway_cmd bar_cmd_position;
197sway_cmd bar_cmd_secondary_button;
198sway_cmd bar_cmd_separator_symbol; 201sway_cmd bar_cmd_separator_symbol;
199sway_cmd bar_cmd_status_command; 202sway_cmd bar_cmd_status_command;
203sway_cmd bar_cmd_status_edge_padding;
204sway_cmd bar_cmd_status_padding;
200sway_cmd bar_cmd_pango_markup; 205sway_cmd bar_cmd_pango_markup;
201sway_cmd bar_cmd_strip_workspace_numbers; 206sway_cmd bar_cmd_strip_workspace_numbers;
207sway_cmd bar_cmd_strip_workspace_name;
202sway_cmd bar_cmd_swaybar_command; 208sway_cmd bar_cmd_swaybar_command;
209sway_cmd bar_cmd_tray_bindsym;
203sway_cmd bar_cmd_tray_output; 210sway_cmd bar_cmd_tray_output;
204sway_cmd bar_cmd_tray_padding; 211sway_cmd bar_cmd_tray_padding;
205sway_cmd bar_cmd_wrap_scroll; 212sway_cmd bar_cmd_wrap_scroll;
@@ -255,8 +262,9 @@ sway_cmd output_cmd_scale;
255sway_cmd output_cmd_transform; 262sway_cmd output_cmd_transform;
256 263
257sway_cmd seat_cmd_attach; 264sway_cmd seat_cmd_attach;
258sway_cmd seat_cmd_fallback;
259sway_cmd seat_cmd_cursor; 265sway_cmd seat_cmd_cursor;
266sway_cmd seat_cmd_fallback;
267sway_cmd seat_cmd_hide_cursor;
260 268
261sway_cmd cmd_ipc_cmd; 269sway_cmd cmd_ipc_cmd;
262sway_cmd cmd_ipc_events; 270sway_cmd cmd_ipc_events;
diff --git a/include/sway/config.h b/include/sway/config.h
index c44533ee..96fe899b 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -6,6 +6,7 @@
6#include <time.h> 6#include <time.h>
7#include <wlr/types/wlr_box.h> 7#include <wlr/types/wlr_box.h>
8#include <xkbcommon/xkbcommon.h> 8#include <xkbcommon/xkbcommon.h>
9#include "../include/config.h"
9#include "list.h" 10#include "list.h"
10#include "swaynag.h" 11#include "swaynag.h"
11#include "tree/container.h" 12#include "tree/container.h"
@@ -26,7 +27,8 @@ struct sway_variable {
26enum binding_input_type { 27enum binding_input_type {
27 BINDING_KEYCODE, 28 BINDING_KEYCODE,
28 BINDING_KEYSYM, 29 BINDING_KEYSYM,
29 BINDING_MOUSE, 30 BINDING_MOUSECODE,
31 BINDING_MOUSESYM,
30}; 32};
31 33
32enum binding_flags { 34enum binding_flags {
@@ -140,6 +142,7 @@ struct seat_config {
140 char *name; 142 char *name;
141 int fallback; // -1 means not set 143 int fallback; // -1 means not set
142 list_t *attachments; // list of seat_attachment configs 144 list_t *attachments; // list of seat_attachment configs
145 int hide_cursor_timeout;
143}; 146};
144 147
145enum config_dpms { 148enum config_dpms {
@@ -224,9 +227,13 @@ struct bar_config {
224 bool wrap_scroll; 227 bool wrap_scroll;
225 char *separator_symbol; 228 char *separator_symbol;
226 bool strip_workspace_numbers; 229 bool strip_workspace_numbers;
230 bool strip_workspace_name;
227 bool binding_mode_indicator; 231 bool binding_mode_indicator;
228 bool verbose; 232 bool verbose;
233 struct side_gaps gaps;
229 pid_t pid; 234 pid_t pid;
235 int status_padding;
236 int status_edge_padding;
230 struct { 237 struct {
231 char *background; 238 char *background;
232 char *statusline; 239 char *statusline;
@@ -250,6 +257,13 @@ struct bar_config {
250 char *binding_mode_bg; 257 char *binding_mode_bg;
251 char *binding_mode_text; 258 char *binding_mode_text;
252 } colors; 259 } colors;
260
261#if HAVE_TRAY
262 char *icon_theme;
263 const char *tray_bindings[10]; // mouse buttons 0-9
264 list_t *tray_outputs; // char *
265 int tray_padding;
266#endif
253}; 267};
254 268
255struct bar_binding { 269struct bar_binding {
@@ -356,6 +370,12 @@ enum mouse_warping_mode {
356 WARP_CONTAINER 370 WARP_CONTAINER
357}; 371};
358 372
373enum alignment {
374 ALIGN_LEFT,
375 ALIGN_CENTER,
376 ALIGN_RIGHT
377};
378
359/** 379/**
360 * The configuration struct. The result of loading a config file. 380 * The configuration struct. The result of loading a config file.
361 */ 381 */
@@ -390,6 +410,9 @@ struct sway_config {
390 size_t font_height; 410 size_t font_height;
391 size_t font_baseline; 411 size_t font_baseline;
392 bool pango_markup; 412 bool pango_markup;
413 int titlebar_border_thickness;
414 int titlebar_h_padding;
415 int titlebar_v_padding;
393 size_t urgent_timeout; 416 size_t urgent_timeout;
394 enum sway_fowa focus_on_window_activation; 417 enum sway_fowa focus_on_window_activation;
395 enum sway_popup_during_fullscreen popup_during_fullscreen; 418 enum sway_popup_during_fullscreen popup_during_fullscreen;
@@ -406,7 +429,10 @@ struct sway_config {
406 bool validating; 429 bool validating;
407 bool auto_back_and_forth; 430 bool auto_back_and_forth;
408 bool show_marks; 431 bool show_marks;
432 enum alignment title_align;
433
409 bool tiling_drag; 434 bool tiling_drag;
435 int tiling_drag_threshold;
410 436
411 bool smart_gaps; 437 bool smart_gaps;
412 int gaps_inner; 438 int gaps_inner;
@@ -415,6 +441,8 @@ struct sway_config {
415 list_t *config_chain; 441 list_t *config_chain;
416 const char *current_config_path; 442 const char *current_config_path;
417 const char *current_config; 443 const char *current_config;
444 int current_config_line_number;
445 char *current_config_line;
418 446
419 enum sway_container_border border; 447 enum sway_container_border border;
420 enum sway_container_border floating_border; 448 enum sway_container_border floating_border;
@@ -480,6 +508,11 @@ bool read_config(FILE *file, struct sway_config *config,
480 struct swaynag_instance *swaynag); 508 struct swaynag_instance *swaynag);
481 509
482/** 510/**
511 * Adds a warning entry to the swaynag instance used for errors.
512 */
513void config_add_swaynag_warning(char *fmt, ...);
514
515/**
483 * Free config struct 516 * Free config struct
484 */ 517 */
485void free_config(struct sway_config *config); 518void free_config(struct sway_config *config);
@@ -516,7 +549,7 @@ struct seat_attachment_config *seat_attachment_config_new(void);
516struct seat_attachment_config *seat_config_get_attachment( 549struct seat_attachment_config *seat_config_get_attachment(
517 struct seat_config *seat_config, char *identifier); 550 struct seat_config *seat_config, char *identifier);
518 551
519void apply_seat_config(struct seat_config *seat); 552struct seat_config *store_seat_config(struct seat_config *seat);
520 553
521int output_name_cmp(const void *item, const void *data); 554int output_name_cmp(const void *item, const void *data);
522 555
@@ -535,8 +568,6 @@ void apply_output_config_to_outputs(struct output_config *oc);
535 568
536void free_output_config(struct output_config *oc); 569void free_output_config(struct output_config *oc);
537 570
538void create_default_output_configs(void);
539
540int workspace_output_cmp_workspace(const void *a, const void *b); 571int workspace_output_cmp_workspace(const void *a, const void *b);
541 572
542int sway_binding_cmp(const void *a, const void *b); 573int sway_binding_cmp(const void *a, const void *b);
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h
index 50ac453b..77aa0ea1 100644
--- a/include/sway/input/cursor.h
+++ b/include/sway/input/cursor.h
@@ -1,10 +1,17 @@
1#ifndef _SWAY_INPUT_CURSOR_H 1#ifndef _SWAY_INPUT_CURSOR_H
2#define _SWAY_INPUT_CURSOR_H 2#define _SWAY_INPUT_CURSOR_H
3#include <stdbool.h>
3#include <stdint.h> 4#include <stdint.h>
5#include <wlr/types/wlr_surface.h>
4#include "sway/input/seat.h" 6#include "sway/input/seat.h"
5 7
6#define SWAY_CURSOR_PRESSED_BUTTONS_CAP 32 8#define SWAY_CURSOR_PRESSED_BUTTONS_CAP 32
7 9
10#define SWAY_SCROLL_UP KEY_MAX + 1
11#define SWAY_SCROLL_DOWN KEY_MAX + 2
12#define SWAY_SCROLL_LEFT KEY_MAX + 3
13#define SWAY_SCROLL_RIGHT KEY_MAX + 4
14
8struct sway_cursor { 15struct sway_cursor {
9 struct sway_seat *seat; 16 struct sway_seat *seat;
10 struct wlr_cursor *cursor; 17 struct wlr_cursor *cursor;
@@ -16,6 +23,8 @@ struct sway_cursor {
16 23
17 const char *image; 24 const char *image;
18 struct wl_client *image_client; 25 struct wl_client *image_client;
26 struct wlr_surface *image_surface;
27 int hotspot_x, hotspot_y;
19 28
20 struct wl_listener motion; 29 struct wl_listener motion;
21 struct wl_listener motion_absolute; 30 struct wl_listener motion_absolute;
@@ -33,11 +42,20 @@ struct sway_cursor {
33 42
34 struct wl_listener request_set_cursor; 43 struct wl_listener request_set_cursor;
35 44
45 struct wl_event_source *hide_source;
46 bool hidden;
47
36 // Mouse binding state 48 // Mouse binding state
37 uint32_t pressed_buttons[SWAY_CURSOR_PRESSED_BUTTONS_CAP]; 49 uint32_t pressed_buttons[SWAY_CURSOR_PRESSED_BUTTONS_CAP];
38 size_t pressed_button_count; 50 size_t pressed_button_count;
39}; 51};
40 52
53struct sway_node;
54
55struct sway_node *node_at_coords(
56 struct sway_seat *seat, double lx, double ly,
57 struct wlr_surface **surface, double *sx, double *sy);
58
41void sway_cursor_destroy(struct sway_cursor *cursor); 59void sway_cursor_destroy(struct sway_cursor *cursor);
42struct sway_cursor *sway_cursor_create(struct sway_seat *seat); 60struct sway_cursor *sway_cursor_create(struct sway_seat *seat);
43 61
@@ -48,6 +66,10 @@ struct sway_cursor *sway_cursor_create(struct sway_seat *seat);
48 */ 66 */
49void cursor_rebase(struct sway_cursor *cursor); 67void cursor_rebase(struct sway_cursor *cursor);
50 68
69void cursor_handle_activity(struct sway_cursor *cursor);
70void cursor_unhide(struct sway_cursor *cursor);
71int cursor_get_timeout(struct sway_cursor *cursor);
72
51/** 73/**
52 * Like cursor_rebase, but also allows focus to change when the cursor enters a 74 * Like cursor_rebase, but also allows focus to change when the cursor enters a
53 * new container. 75 * new container.
@@ -58,12 +80,27 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
58 struct wlr_input_device *device, uint32_t time_msec, uint32_t button, 80 struct wlr_input_device *device, uint32_t time_msec, uint32_t button,
59 enum wlr_button_state state); 81 enum wlr_button_state state);
60 82
83void dispatch_cursor_axis(struct sway_cursor *cursor,
84 struct wlr_event_pointer_axis *event);
85
61void cursor_set_image(struct sway_cursor *cursor, const char *image, 86void cursor_set_image(struct sway_cursor *cursor, const char *image,
62 struct wl_client *client); 87 struct wl_client *client);
63 88
89void cursor_set_image_surface(struct sway_cursor *cursor,
90 struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y,
91 struct wl_client *client);
92
64void cursor_warp_to_container(struct sway_cursor *cursor, 93void cursor_warp_to_container(struct sway_cursor *cursor,
65 struct sway_container *container); 94 struct sway_container *container);
66 95
67void cursor_warp_to_workspace(struct sway_cursor *cursor, 96void cursor_warp_to_workspace(struct sway_cursor *cursor,
68 struct sway_workspace *workspace); 97 struct sway_workspace *workspace);
98
99uint32_t get_mouse_bindsym(const char *name, char **error);
100
101uint32_t get_mouse_bindcode(const char *name, char **error);
102
103// Considers both bindsym and bindcode
104uint32_t get_mouse_button(const char *name, char **error);
105
69#endif 106#endif
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h
index 219aa9ba..8e8bf1f2 100644
--- a/include/sway/input/input-manager.h
+++ b/include/sway/input/input-manager.h
@@ -37,6 +37,10 @@ void input_manager_configure_xcursor(void);
37 37
38void input_manager_apply_input_config(struct input_config *input_config); 38void input_manager_apply_input_config(struct input_config *input_config);
39 39
40void input_manager_reset_input(struct sway_input_device *input_device);
41
42void input_manager_reset_all_inputs();
43
40void input_manager_apply_seat_config(struct seat_config *seat_config); 44void input_manager_apply_seat_config(struct seat_config *seat_config);
41 45
42struct sway_seat *input_manager_get_default_seat(void); 46struct sway_seat *input_manager_get_default_seat(void);
@@ -44,6 +48,12 @@ struct sway_seat *input_manager_get_default_seat(void);
44struct sway_seat *input_manager_get_seat(const char *seat_name); 48struct sway_seat *input_manager_get_seat(const char *seat_name);
45 49
46/** 50/**
51 * If none of the seat configs have a fallback setting (either true or false),
52 * create the default seat (if needed) and set it as the fallback
53 */
54void input_manager_verify_fallback_seat(void);
55
56/**
47 * Gets the last seat the user interacted with 57 * Gets the last seat the user interacted with
48 */ 58 */
49struct sway_seat *input_manager_current_seat(void); 59struct sway_seat *input_manager_current_seat(void);
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index bef2af77..d2f14895 100644
--- a/include/sway/input/seat.h
+++ b/include/sway/input/seat.h
@@ -6,6 +6,17 @@
6#include <wlr/util/edges.h> 6#include <wlr/util/edges.h>
7#include "sway/input/input-manager.h" 7#include "sway/input/input-manager.h"
8 8
9struct sway_seat;
10
11struct sway_seatop_impl {
12 void (*motion)(struct sway_seat *seat, uint32_t time_msec);
13 void (*finish)(struct sway_seat *seat);
14 void (*abort)(struct sway_seat *seat);
15 void (*unref)(struct sway_seat *seat, struct sway_container *con);
16 void (*render)(struct sway_seat *seat, struct sway_output *output,
17 pixman_region32_t *damage);
18};
19
9struct sway_seat_device { 20struct sway_seat_device {
10 struct sway_seat *sway_seat; 21 struct sway_seat *sway_seat;
11 struct sway_input_device *input_device; 22 struct sway_input_device *input_device;
@@ -35,15 +46,6 @@ struct sway_drag_icon {
35 struct wl_listener destroy; 46 struct wl_listener destroy;
36}; 47};
37 48
38enum sway_seat_operation {
39 OP_NONE,
40 OP_DOWN,
41 OP_MOVE_FLOATING,
42 OP_MOVE_TILING,
43 OP_RESIZE_FLOATING,
44 OP_RESIZE_TILING,
45};
46
47struct sway_seat { 49struct sway_seat {
48 struct wlr_seat *wlr_seat; 50 struct wlr_seat *wlr_seat;
49 struct sway_cursor *cursor; 51 struct sway_cursor *cursor;
@@ -63,19 +65,10 @@ struct sway_seat {
63 int32_t touch_id; 65 int32_t touch_id;
64 double touch_x, touch_y; 66 double touch_x, touch_y;
65 67
66 // Operations (drag and resize) 68 // Seat operations (drag and resize)
67 enum sway_seat_operation operation; 69 const struct sway_seatop_impl *seatop_impl;
68 struct sway_container *op_container; 70 void *seatop_data;
69 struct sway_node *op_target_node; // target for tiling move 71 uint32_t seatop_button;
70 enum wlr_edges op_target_edge;
71 struct wlr_box op_drop_box;
72 enum wlr_edges op_resize_edge;
73 uint32_t op_button;
74 bool op_resize_preserve_ratio;
75 double op_ref_lx, op_ref_ly; // cursor's x/y at start of op
76 double op_ref_width, op_ref_height; // container's size at start of op
77 double op_ref_con_lx, op_ref_con_ly; // container's x/y at start of op
78 bool op_moved; // if the mouse moved during a down op
79 72
80 uint32_t last_button; 73 uint32_t last_button;
81 uint32_t last_button_serial; 74 uint32_t last_button_serial;
@@ -99,6 +92,9 @@ void seat_add_device(struct sway_seat *seat,
99void seat_configure_device(struct sway_seat *seat, 92void seat_configure_device(struct sway_seat *seat,
100 struct sway_input_device *device); 93 struct sway_input_device *device);
101 94
95void seat_reset_device(struct sway_seat *seat,
96 struct sway_input_device *input_device);
97
102void seat_remove_device(struct sway_seat *seat, 98void seat_remove_device(struct sway_seat *seat,
103 struct sway_input_device *device); 99 struct sway_input_device *device);
104 100
@@ -174,33 +170,65 @@ void seat_apply_config(struct sway_seat *seat, struct seat_config *seat_config);
174 170
175struct seat_config *seat_get_config(struct sway_seat *seat); 171struct seat_config *seat_get_config(struct sway_seat *seat);
176 172
173struct seat_config *seat_get_config_by_name(const char *name);
174
177bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); 175bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface);
178 176
179void drag_icon_update_position(struct sway_drag_icon *icon); 177void drag_icon_update_position(struct sway_drag_icon *icon);
180 178
181void seat_begin_down(struct sway_seat *seat, struct sway_container *con, 179void seatop_begin_down(struct sway_seat *seat,
182 uint32_t button, double sx, double sy); 180 struct sway_container *con, uint32_t button, int sx, int sy);
183 181
184void seat_begin_move_floating(struct sway_seat *seat, 182void seatop_begin_move_floating(struct sway_seat *seat,
185 struct sway_container *con, uint32_t button); 183 struct sway_container *con, uint32_t button);
186 184
187void seat_begin_move_tiling(struct sway_seat *seat, 185void seatop_begin_move_tiling_threshold(struct sway_seat *seat,
188 struct sway_container *con, uint32_t button); 186 struct sway_container *con, uint32_t button);
189 187
190void seat_begin_resize_floating(struct sway_seat *seat, 188void seatop_begin_move_tiling(struct sway_seat *seat,
189 struct sway_container *con, uint32_t button);
190
191void seatop_begin_resize_floating(struct sway_seat *seat,
191 struct sway_container *con, uint32_t button, enum wlr_edges edge); 192 struct sway_container *con, uint32_t button, enum wlr_edges edge);
192 193
193void seat_begin_resize_tiling(struct sway_seat *seat, 194void seatop_begin_resize_tiling(struct sway_seat *seat,
194 struct sway_container *con, uint32_t button, enum wlr_edges edge); 195 struct sway_container *con, uint32_t button, enum wlr_edges edge);
195 196
196struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat, 197struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat,
197 struct sway_workspace *workspace); 198 struct sway_workspace *workspace);
198 199
199void seat_end_mouse_operation(struct sway_seat *seat);
200
201void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, 200void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec,
202 uint32_t button, enum wlr_button_state state); 201 uint32_t button, enum wlr_button_state state);
203 202
204void seat_consider_warp_to_focus(struct sway_seat *seat); 203void seat_consider_warp_to_focus(struct sway_seat *seat);
205 204
205bool seat_doing_seatop(struct sway_seat *seat);
206
207void seatop_motion(struct sway_seat *seat, uint32_t time_msec);
208
209/**
210 * End a seatop and apply the affects.
211 */
212void seatop_finish(struct sway_seat *seat);
213
214/**
215 * End a seatop without applying the affects.
216 */
217void seatop_abort(struct sway_seat *seat);
218
219/**
220 * Instructs the seatop implementation to drop any references to the given
221 * container (eg. because the container is destroying).
222 * The seatop may choose to abort itself in response to this.
223 */
224void seatop_unref(struct sway_seat *seat, struct sway_container *con);
225
226/**
227 * Instructs a seatop to render anything that it needs to render
228 * (eg. dropzone for move-tiling)
229 */
230void seatop_render(struct sway_seat *seat, struct sway_output *output,
231 pixman_region32_t *damage);
232
233
206#endif 234#endif
diff --git a/include/sway/output.h b/include/sway/output.h
index 43c1ab96..bdf9614d 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -84,9 +84,7 @@ void output_damage_box(struct sway_output *output, struct wlr_box *box);
84void output_damage_whole_container(struct sway_output *output, 84void output_damage_whole_container(struct sway_output *output,
85 struct sway_container *con); 85 struct sway_container *con);
86 86
87struct sway_output *output_by_name(const char *name); 87struct sway_output *output_by_name_or_id(const char *name_or_id);
88
89struct sway_output *output_by_identifier(const char *identifier);
90 88
91void output_sort_workspaces(struct sway_output *output); 89void output_sort_workspaces(struct sway_output *output);
92 90
@@ -148,4 +146,12 @@ enum sway_container_layout output_get_default_layout(
148 146
149void output_add_listeners(struct sway_output *output); 147void output_add_listeners(struct sway_output *output);
150 148
149void render_rect(struct wlr_output *wlr_output,
150 pixman_region32_t *output_damage, const struct wlr_box *_box,
151 float color[static 4]);
152
153void premultiply_alpha(float color[4], float opacity);
154
155void scale_box(struct wlr_box *box, float scale);
156
151#endif 157#endif
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index f907aad2..9a432cb2 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -10,12 +10,6 @@
10struct sway_view; 10struct sway_view;
11struct sway_seat; 11struct sway_seat;
12 12
13#define TITLEBAR_BORDER_THICKNESS 1
14
15// Padding includes titlebar border
16#define TITLEBAR_H_PADDING 3
17#define TITLEBAR_V_PADDING 4
18
19enum sway_container_layout { 13enum sway_container_layout {
20 L_NONE, 14 L_NONE,
21 L_HORIZ, 15 L_HORIZ,
@@ -339,4 +333,6 @@ void container_add_mark(struct sway_container *container, char *mark);
339 333
340void container_update_marks_textures(struct sway_container *container); 334void container_update_marks_textures(struct sway_container *container);
341 335
336void container_raise_floating(struct sway_container *con);
337
342#endif 338#endif
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 4716c688..5cc9777b 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -195,6 +195,7 @@ struct sway_view_child {
195 195
196 struct sway_view *view; 196 struct sway_view *view;
197 struct wlr_surface *surface; 197 struct wlr_surface *surface;
198 bool mapped;
198 199
199 struct wl_listener surface_commit; 200 struct wl_listener surface_commit;
200 struct wl_listener surface_new_subsurface; 201 struct wl_listener surface_new_subsurface;
@@ -203,6 +204,12 @@ struct sway_view_child {
203 struct wl_listener surface_destroy; 204 struct wl_listener surface_destroy;
204}; 205};
205 206
207struct sway_subsurface {
208 struct sway_view_child child;
209
210 struct wl_listener destroy;
211};
212
206struct sway_xdg_popup_v6 { 213struct sway_xdg_popup_v6 {
207 struct sway_view_child child; 214 struct sway_view_child child;
208 215
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h
index 95b20510..2d9ba0d9 100644
--- a/include/swaybar/bar.h
+++ b/include/swaybar/bar.h
@@ -1,6 +1,7 @@
1#ifndef _SWAYBAR_BAR_H 1#ifndef _SWAYBAR_BAR_H
2#define _SWAYBAR_BAR_H 2#define _SWAYBAR_BAR_H
3#include <wayland-client.h> 3#include <wayland-client.h>
4#include "config.h"
4#include "input.h" 5#include "input.h"
5#include "pool-buffer.h" 6#include "pool-buffer.h"
6#include "wlr-layer-shell-unstable-v1-client-protocol.h" 7#include "wlr-layer-shell-unstable-v1-client-protocol.h"
@@ -8,6 +9,9 @@
8 9
9struct swaybar_config; 10struct swaybar_config;
10struct swaybar_output; 11struct swaybar_output;
12#if HAVE_TRAY
13struct swaybar_tray;
14#endif
11struct swaybar_workspace; 15struct swaybar_workspace;
12struct loop; 16struct loop;
13 17
@@ -38,6 +42,10 @@ struct swaybar {
38 int ipc_socketfd; 42 int ipc_socketfd;
39 43
40 struct wl_list outputs; // swaybar_output::link 44 struct wl_list outputs; // swaybar_output::link
45
46#if HAVE_TRAY
47 struct swaybar_tray *tray;
48#endif
41}; 49};
42 50
43struct swaybar_output { 51struct swaybar_output {
@@ -53,6 +61,7 @@ struct swaybar_output {
53 struct wl_list hotspots; // swaybar_hotspot::link 61 struct wl_list hotspots; // swaybar_hotspot::link
54 62
55 char *name; 63 char *name;
64 char *identifier;
56 bool focused; 65 bool focused;
57 66
58 uint32_t width, height; 67 uint32_t width, height;
@@ -62,12 +71,15 @@ struct swaybar_output {
62 struct pool_buffer *current_buffer; 71 struct pool_buffer *current_buffer;
63 bool dirty; 72 bool dirty;
64 bool frame_scheduled; 73 bool frame_scheduled;
74
75 uint32_t output_height, output_width, output_x, output_y;
65}; 76};
66 77
67struct swaybar_workspace { 78struct swaybar_workspace {
68 struct wl_list link; // swaybar_output::workspaces 79 struct wl_list link; // swaybar_output::workspaces
69 int num; 80 int num;
70 char *name; 81 char *name;
82 char *label;
71 bool focused; 83 bool focused;
72 bool visible; 84 bool visible;
73 bool urgent; 85 bool urgent;
@@ -77,6 +89,8 @@ bool bar_setup(struct swaybar *bar, const char *socket_path);
77void bar_run(struct swaybar *bar); 89void bar_run(struct swaybar *bar);
78void bar_teardown(struct swaybar *bar); 90void bar_teardown(struct swaybar *bar);
79 91
92void set_bar_dirty(struct swaybar *bar);
93
80/* 94/*
81 * Determines whether the bar should be visible and changes it to be so. 95 * Determines whether the bar should be visible and changes it to be so.
82 * If the current visibility of the bar is the different to what it should be, 96 * If the current visibility of the bar is the different to what it should be,
diff --git a/include/swaybar/config.h b/include/swaybar/config.h
index 5d40790a..add0a1cf 100644
--- a/include/swaybar/config.h
+++ b/include/swaybar/config.h
@@ -3,6 +3,7 @@
3#include <stdbool.h> 3#include <stdbool.h>
4#include <stdint.h> 4#include <stdint.h>
5#include <wayland-client.h> 5#include <wayland-client.h>
6#include "../include/config.h"
6#include "list.h" 7#include "list.h"
7#include "util.h" 8#include "util.h"
8 9
@@ -34,6 +35,7 @@ struct swaybar_config {
34 char *hidden_state; 35 char *hidden_state;
35 char *modifier; 36 char *modifier;
36 bool strip_workspace_numbers; 37 bool strip_workspace_numbers;
38 bool strip_workspace_name;
37 bool binding_mode_indicator; 39 bool binding_mode_indicator;
38 bool wrap_scroll; 40 bool wrap_scroll;
39 bool workspace_buttons; 41 bool workspace_buttons;
@@ -41,6 +43,14 @@ struct swaybar_config {
41 struct wl_list outputs; // config_output::link 43 struct wl_list outputs; // config_output::link
42 bool all_outputs; 44 bool all_outputs;
43 int height; 45 int height;
46 int status_padding;
47 int status_edge_padding;
48 struct {
49 int top;
50 int right;
51 int bottom;
52 int left;
53 } gaps;
44 54
45 struct { 55 struct {
46 uint32_t background; 56 uint32_t background;
@@ -57,6 +67,14 @@ struct swaybar_config {
57 struct box_colors urgent_workspace; 67 struct box_colors urgent_workspace;
58 struct box_colors binding_mode; 68 struct box_colors binding_mode;
59 } colors; 69 } colors;
70
71#if HAVE_TRAY
72 char *icon_theme;
73 char *tray_bindings[10]; // mouse buttons 0-9
74 bool tray_hidden;
75 list_t *tray_outputs; // char *
76 int tray_padding;
77#endif
60}; 78};
61 79
62struct swaybar_config *init_config(void); 80struct swaybar_config *init_config(void);
diff --git a/include/swaybar/i3bar.h b/include/swaybar/i3bar.h
index 3f1ecc25..aa4415ff 100644
--- a/include/swaybar/i3bar.h
+++ b/include/swaybar/i3bar.h
@@ -27,6 +27,7 @@ struct i3bar_block {
27void i3bar_block_unref(struct i3bar_block *block); 27void i3bar_block_unref(struct i3bar_block *block);
28bool i3bar_handle_readable(struct status_line *status); 28bool i3bar_handle_readable(struct status_line *status);
29enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, 29enum hotspot_event_handling i3bar_block_send_click(struct status_line *status,
30 struct i3bar_block *block, int x, int y, enum x11_button button); 30 struct i3bar_block *block, int x, int y, int rx, int ry, int w, int h,
31 uint32_t button);
31 32
32#endif 33#endif
diff --git a/include/swaybar/input.h b/include/swaybar/input.h
index a552e7ac..4b46b0de 100644
--- a/include/swaybar/input.h
+++ b/include/swaybar/input.h
@@ -4,6 +4,12 @@
4#include <wayland-client.h> 4#include <wayland-client.h>
5#include "list.h" 5#include "list.h"
6 6
7#define SWAY_SCROLL_UP KEY_MAX + 1
8#define SWAY_SCROLL_DOWN KEY_MAX + 2
9#define SWAY_SCROLL_LEFT KEY_MAX + 3
10#define SWAY_SCROLL_RIGHT KEY_MAX + 4
11
12struct swaybar;
7struct swaybar_output; 13struct swaybar_output;
8 14
9struct swaybar_pointer { 15struct swaybar_pointer {
@@ -13,6 +19,7 @@ struct swaybar_pointer {
13 struct wl_surface *cursor_surface; 19 struct wl_surface *cursor_surface;
14 struct swaybar_output *current; 20 struct swaybar_output *current;
15 int x, y; 21 int x, y;
22 uint32_t serial;
16}; 23};
17 24
18enum x11_button { 25enum x11_button {
@@ -37,13 +44,16 @@ struct swaybar_hotspot {
37 struct wl_list link; // swaybar_output::hotspots 44 struct wl_list link; // swaybar_output::hotspots
38 int x, y, width, height; 45 int x, y, width, height;
39 enum hotspot_event_handling (*callback)(struct swaybar_output *output, 46 enum hotspot_event_handling (*callback)(struct swaybar_output *output,
40 int x, int y, enum x11_button button, void *data); 47 struct swaybar_hotspot *hotspot, int x, int y, uint32_t button,
48 void *data);
41 void (*destroy)(void *data); 49 void (*destroy)(void *data);
42 void *data; 50 void *data;
43}; 51};
44 52
45extern const struct wl_seat_listener seat_listener; 53extern const struct wl_seat_listener seat_listener;
46 54
55void update_cursor(struct swaybar *bar);
56
47void free_hotspots(struct wl_list *list); 57void free_hotspots(struct wl_list *list);
48 58
49#endif 59#endif
diff --git a/include/swaybar/tray/host.h b/include/swaybar/tray/host.h
new file mode 100644
index 00000000..2d4cf82b
--- /dev/null
+++ b/include/swaybar/tray/host.h
@@ -0,0 +1,17 @@
1#ifndef _SWAYBAR_TRAY_HOST_H
2#define _SWAYBAR_TRAY_HOST_H
3
4#include <stdbool.h>
5
6struct swaybar_tray;
7
8struct swaybar_host {
9 struct swaybar_tray *tray;
10 char *service;
11 char *watcher_interface;
12};
13
14bool init_host(struct swaybar_host *host, char *protocol, struct swaybar_tray *tray);
15void finish_host(struct swaybar_host *host);
16
17#endif
diff --git a/include/swaybar/tray/icon.h b/include/swaybar/tray/icon.h
index 1cc6ff9c..7a6c400c 100644
--- a/include/swaybar/tray/icon.h
+++ b/include/swaybar/tray/icon.h
@@ -1,16 +1,44 @@
1#ifndef _SWAYBAR_ICON_H 1#ifndef _SWAYBAR_TRAY_ICON_H
2#define _SWAYBAR_ICON_H 2#define _SWAYBAR_TRAY_ICON_H
3 3
4#include <stdint.h> 4#include "list.h"
5#include <stdbool.h>
6#include <client/cairo.h>
7 5
8/** 6enum subdir_type {
9 * Returns the image found by `name` that is closest to `size` 7 THRESHOLD,
10 */ 8 SCALABLE,
11cairo_surface_t *find_icon(const char *name, int size); 9 FIXED
10};
11
12struct icon_theme_subdir {
13 char *name;
14 int size;
15 enum subdir_type type;
16 int max_size;
17 int min_size;
18 int threshold;
19};
20
21struct icon_theme {
22 char *name;
23 char *comment;
24 char *inherits;
25 list_t *directories; // char *
12 26
13/* Struct used internally only */ 27 char *dir;
14struct subdir; 28 list_t *subdirs; // struct icon_theme_subdir *
29};
30
31void init_themes(list_t **themes, list_t **basedirs);
32void finish_themes(list_t *themes, list_t *basedirs);
33
34/*
35 * Finds an icon of a specified size given a list of themes and base directories.
36 * If the icon is found, the pointers min_size & max_size are set to minimum &
37 * maximum size that the icon can be scaled to, respectively.
38 * Returns: path of icon (which should be freed), or NULL if the icon is not found.
39 */
40char *find_icon(list_t *themes, list_t *basedirs, char *name, int size,
41 char *theme, int *min_size, int *max_size);
42char *find_icon_in_dir(char *name, char *dir, int *min_size, int *max_size);
15 43
16#endif /* _SWAYBAR_ICON_H */ 44#endif
diff --git a/include/swaybar/tray/item.h b/include/swaybar/tray/item.h
new file mode 100644
index 00000000..4238bdb8
--- /dev/null
+++ b/include/swaybar/tray/item.h
@@ -0,0 +1,49 @@
1#ifndef _SWAYBAR_TRAY_ITEM_H
2#define _SWAYBAR_TRAY_ITEM_H
3
4#include <cairo.h>
5#include <stdbool.h>
6#include <stdint.h>
7#include "swaybar/tray/tray.h"
8#include "list.h"
9
10struct swaybar_output;
11
12struct swaybar_pixmap {
13 int size;
14 unsigned char pixels[];
15};
16
17struct swaybar_sni {
18 // icon properties
19 struct swaybar_tray *tray;
20 cairo_surface_t *icon;
21 int min_size;
22 int max_size;
23
24 // dbus properties
25 char *watcher_id;
26 char *service;
27 char *path;
28 char *interface;
29
30 char *status;
31 char *icon_name;
32 list_t *icon_pixmap; // struct swaybar_pixmap *
33 char *attention_icon_name;
34 list_t *attention_icon_pixmap; // struct swaybar_pixmap *
35 bool item_is_menu;
36 char *menu;
37 char *icon_theme_path; // non-standard KDE property
38
39 sd_bus_slot *new_icon_slot;
40 sd_bus_slot *new_attention_icon_slot;
41 sd_bus_slot *new_status_slot;
42};
43
44struct swaybar_sni *create_sni(char *id, struct swaybar_tray *tray);
45void destroy_sni(struct swaybar_sni *sni);
46uint32_t render_sni(cairo_t *cairo, struct swaybar_output *output, double *x,
47 struct swaybar_sni *sni);
48
49#endif
diff --git a/include/swaybar/tray/sni.h b/include/swaybar/tray/sni.h
deleted file mode 100644
index c2544e2a..00000000
--- a/include/swaybar/tray/sni.h
+++ /dev/null
@@ -1,82 +0,0 @@
1#ifndef _SWAYBAR_SNI_H
2#define _SWAYBAR_SNI_H
3
4#include <stdbool.h>
5#include <client/cairo.h>
6
7struct StatusNotifierItem {
8 /* Name registered to sni watcher */
9 char *name;
10 /* Unique bus name, needed for determining signal origins */
11 char *unique_name;
12 bool kde_special_snowflake;
13
14 cairo_surface_t *image;
15 bool dirty;
16};
17
18/* Each output holds an sni_icon_ref of each item to render */
19struct sni_icon_ref {
20 cairo_surface_t *icon;
21 struct StatusNotifierItem *ref;
22};
23
24struct sni_icon_ref *sni_icon_ref_create(struct StatusNotifierItem *item,
25 int height);
26
27void sni_icon_ref_free(struct sni_icon_ref *sni_ref);
28
29/**
30 * Will return a new item and get its icon. (see warning below)
31 * May return `NULL` if `name` is not valid.
32 */
33struct StatusNotifierItem *sni_create(const char *name);
34
35/**
36 * `item` must be a struct StatusNotifierItem *
37 * `str` must be a NUL terminated char *
38 *
39 * Returns 0 if `item` has a name of `str`
40 */
41int sni_str_cmp(const void *item, const void *str);
42
43/**
44 * Returns 0 if `item` has a unique name of `str` or if
45 * `item->unique_name == NULL`
46 */
47int sni_uniq_cmp(const void *item, const void *str);
48
49/**
50 * Gets an icon for the given item if found.
51 *
52 * XXX
53 * This function keeps a reference to the item until it gets responses, make
54 * sure that the reference and item are valid during this time.
55 */
56void get_icon(struct StatusNotifierItem *item);
57
58/**
59 * Calls the "activate" method on the given StatusNotifierItem
60 *
61 * x and y should be where the item was clicked
62 */
63void sni_activate(struct StatusNotifierItem *item, uint32_t x, uint32_t y);
64
65/**
66 * Asks the item to draw a context menu at the given x and y coords
67 */
68void sni_context_menu(struct StatusNotifierItem *item, uint32_t x, uint32_t y);
69
70/**
71 * Calls the "secondary activate" method on the given StatusNotifierItem
72 *
73 * x and y should be where the item was clicked
74 */
75void sni_secondary(struct StatusNotifierItem *item, uint32_t x, uint32_t y);
76
77/**
78 * Deconstructs `item`
79 */
80void sni_free(struct StatusNotifierItem *item);
81
82#endif /* _SWAYBAR_SNI_H */
diff --git a/include/swaybar/tray/tray.h b/include/swaybar/tray/tray.h
new file mode 100644
index 00000000..8958b69a
--- /dev/null
+++ b/include/swaybar/tray/tray.h
@@ -0,0 +1,40 @@
1#ifndef _SWAYBAR_TRAY_TRAY_H
2#define _SWAYBAR_TRAY_TRAY_H
3
4#include "config.h"
5#ifdef HAVE_SYSTEMD
6#include <systemd/sd-bus.h>
7#elif HAVE_ELOGIND
8#include <elogind/sd-bus.h>
9#endif
10#include <cairo.h>
11#include <stdint.h>
12#include "swaybar/tray/host.h"
13#include "list.h"
14
15struct swaybar;
16struct swaybar_output;
17struct swaybar_watcher;
18
19struct swaybar_tray {
20 struct swaybar *bar;
21
22 int fd;
23 sd_bus *bus;
24
25 struct swaybar_host host_xdg;
26 struct swaybar_host host_kde;
27 list_t *items; // struct swaybar_sni *
28 struct swaybar_watcher *watcher_xdg;
29 struct swaybar_watcher *watcher_kde;
30
31 list_t *basedirs; // char *
32 list_t *themes; // struct swaybar_theme *
33};
34
35struct swaybar_tray *create_tray(struct swaybar *bar);
36void destroy_tray(struct swaybar_tray *tray);
37void tray_in(int fd, short mask, void *data);
38uint32_t render_tray(cairo_t *cairo, struct swaybar_output *output, double *x);
39
40#endif
diff --git a/include/swaybar/tray/watcher.h b/include/swaybar/tray/watcher.h
new file mode 100644
index 00000000..8f276da8
--- /dev/null
+++ b/include/swaybar/tray/watcher.h
@@ -0,0 +1,18 @@
1#ifndef _SWAYBAR_TRAY_WATCHER_H
2#define _SWAYBAR_TRAY_WATCHER_H
3
4#include "swaybar/tray/tray.h"
5#include "list.h"
6
7struct swaybar_watcher {
8 char *interface;
9 sd_bus *bus;
10 list_t *hosts;
11 list_t *items;
12 int version;
13};
14
15struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus);
16void destroy_watcher(struct swaybar_watcher *watcher);
17
18#endif
diff --git a/include/swaylock/swaylock.h b/include/swaylock/swaylock.h
index 18af7ab4..516a56f4 100644
--- a/include/swaylock/swaylock.h
+++ b/include/swaylock/swaylock.h
@@ -22,6 +22,7 @@ enum auth_state {
22struct swaylock_colorset { 22struct swaylock_colorset {
23 uint32_t input; 23 uint32_t input;
24 uint32_t cleared; 24 uint32_t cleared;
25 uint32_t caps_lock;
25 uint32_t verifying; 26 uint32_t verifying;
26 uint32_t wrong; 27 uint32_t wrong;
27}; 28};
@@ -30,6 +31,8 @@ struct swaylock_colors {
30 uint32_t background; 31 uint32_t background;
31 uint32_t bs_highlight; 32 uint32_t bs_highlight;
32 uint32_t key_highlight; 33 uint32_t key_highlight;
34 uint32_t caps_lock_bs_highlight;
35 uint32_t caps_lock_key_highlight;
33 uint32_t separator; 36 uint32_t separator;
34 struct swaylock_colorset inside; 37 struct swaylock_colorset inside;
35 struct swaylock_colorset line; 38 struct swaylock_colorset line;
@@ -45,6 +48,8 @@ struct swaylock_args {
45 uint32_t thickness; 48 uint32_t thickness;
46 bool ignore_empty; 49 bool ignore_empty;
47 bool show_indicator; 50 bool show_indicator;
51 bool show_caps_lock_text;
52 bool show_caps_lock_indicator;
48 bool daemonize; 53 bool daemonize;
49}; 54};
50 55
diff --git a/include/swaynag/swaynag.h b/include/swaynag/swaynag.h
index a32d1503..0fd1eb50 100644
--- a/include/swaynag/swaynag.h
+++ b/include/swaynag/swaynag.h
@@ -44,6 +44,7 @@ struct swaynag_button {
44 int y; 44 int y;
45 int width; 45 int width;
46 int height; 46 int height;
47 bool terminal;
47}; 48};
48 49
49struct swaynag_details { 50struct swaynag_details {