i3
data.h
Go to the documentation of this file.
1/*
2 * vim:ts=4:sw=4:expandtab
3 *
4 * i3 - an improved dynamic tiling window manager
5 * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
6 *
7 * include/data.h: This file defines all data structures used by i3
8 *
9 */
10#pragma once
11
12#include "libi3.h"
13
14#define SN_API_NOT_YET_FROZEN 1
15#include <libsn/sn-launcher.h>
16
17#include <xcb/randr.h>
18#include <stdbool.h>
19#include <pcre.h>
20#include <sys/time.h>
21
22#include "queue.h"
23
24/*
25 * To get the big concept: There are helper structures like struct
26 * Workspace_Assignment. Every struct which is also defined as type (see
27 * forward definitions) is considered to be a major structure, thus important.
28 *
29 * The following things are all stored in a 'Con', from very high level (the
30 * biggest Cons) to very small (a single window):
31 *
32 * 1) X11 root window (as big as all your outputs combined)
33 * 2) output (like LVDS1)
34 * 3) content container, dockarea containers
35 * 4) workspaces
36 * 5) split containers
37 * ... (you can arbitrarily nest split containers)
38 * 6) X11 window containers
39 *
40 */
41
42/* Forward definitions */
43typedef struct Binding Binding;
44typedef struct Rect Rect;
45typedef struct xoutput Output;
46typedef struct Con Con;
47typedef struct Match Match;
48typedef struct Assignment Assignment;
49typedef struct Window i3Window;
50typedef struct mark_t mark_t;
51
52/******************************************************************************
53 * Helper types
54 *****************************************************************************/
55typedef enum { D_LEFT,
59typedef enum { NO_ORIENTATION = 0,
62typedef enum { BEFORE,
64typedef enum { BS_NORMAL = 0,
67
70typedef enum { DONT_KILL_WINDOW = 0,
73
75typedef enum { ADJ_NONE = 0,
80
81typedef enum { HEBM_NONE = ADJ_NONE,
86
87typedef enum { MM_REPLACE,
89
93typedef enum {
100 L_SPLITH = 6
102
106typedef enum {
108 B_MOUSE = 1
110
114typedef enum {
119 I3_XKB_GROUP_MASK_4 = (1 << 3)
121
128typedef uint32_t i3_event_state_mask_t;
129
133typedef enum {
137
141typedef enum {
147
151typedef enum {
162
163#define QUBE_NUM_LABELS 9
164
175struct Rect {
176 uint32_t x;
177 uint32_t y;
178 uint32_t width;
179 uint32_t height;
180};
181
188 uint32_t left;
189 uint32_t right;
190 uint32_t top;
191 uint32_t bottom;
192};
193
200 uint32_t w;
201 uint32_t h;
202};
203
219};
220
226 char *name;
227 char *output;
228
231};
232
236 time_t added;
237
239 ignore_events;
240};
241
249 char *id;
253 SnLauncherContext *context;
256 time_t delete_at;
257
259 sequences;
260};
261
271struct regex {
272 char *pattern;
273 pcre *regex;
274 pcre_extra *extra;
275};
276
283 xcb_keycode_t keycode;
285
287 keycodes;
288};
289
290/******************************************************************************
291 * Major types
292 *****************************************************************************/
293
300struct Binding {
301 /* The type of input this binding is for. (Mouse bindings are not yet
302 * implemented. All bindings are currently assumed to be keyboard bindings.) */
304
307 enum {
308 /* This binding will only be executed upon KeyPress events */
309 B_UPON_KEYPRESS = 0,
310 /* This binding will be executed either upon a KeyRelease event, or… */
311 B_UPON_KEYRELEASE = 1,
312 /* …upon a KeyRelease event, even if the modifiers don’t match. This
313 * state is triggered from get_binding() when the corresponding
314 * KeyPress (!) happens, so that users can release the modifier keys
315 * before releasing the actual key. */
316 B_UPON_KEYRELEASE_IGNORE_MODS = 2,
317 } release;
318
321 bool border;
322
327
331
333 uint32_t keycode;
334
339
343 char *symbol;
344
348 TAILQ_HEAD(keycodes_head, Binding_Keycode)
349 keycodes_head;
350
352 char *command;
353
356};
357
365struct Autostart {
367 char *command;
371
374
377};
378
380 char *name;
381
383 names;
384};
385
393struct xoutput {
395 xcb_randr_output_t id;
396
399 bool active;
400
406
410 SLIST_HEAD(names_head, output_name)
411 names_head;
412
414 Con *con;
415
417 Rect rect;
418
421};
422
428struct Window {
429 xcb_window_t id;
430
433 xcb_window_t leader;
434 xcb_window_t transient_for;
435
440
443
446
449
452
456 char *role;
457
460
463
466
470
472 xcb_atom_t window_type;
473
475 uint32_t wm_desktop;
476
478 enum { W_NODOCK = 0,
479 W_DOCK_TOP = 1,
480 W_DOCK_BOTTOM = 2 } dock;
481
483 struct timeval urgent;
484
486 struct reservedpx reserved;
487
489 uint16_t depth;
490
491 /* the wanted size of the window, used in combination with size
492 * increments (see below). */
495
496 /* minimum increment size specified for the window (in pixels) */
499
500 /* Minimum size specified for the window. */
503
504 /* Maximum size specified for the window. */
507
508 /* aspect ratio from WM_NORMAL_HINTS (MPlayer uses this for example) */
511
513 bool shaped;
516
517 /* Time when the window became managed. Used to determine whether a window
518 * should be swallowed after initial management. */
520};
521
530struct Match {
531 /* Set if a criterion was specified incorrectly. */
532 char *error;
533
534 struct regex *title;
536 struct regex *class;
538 struct regex *mark;
541 xcb_atom_t window_type;
542 enum {
543 U_DONTCHECK = -1,
544 U_LATEST = 0,
545 U_OLDEST = 1
546 } urgent;
547 enum {
548 M_DONTCHECK = -1,
549 M_NODOCK = 0,
550 M_DOCK_ANY = 1,
551 M_DOCK_TOP = 2,
552 M_DOCK_BOTTOM = 3
553 } dock;
554 xcb_window_t id;
555 enum { WM_ANY = 0,
557 WM_FLOATING } window_mode;
559
560 /* Where the window looking for a match should be inserted:
561 *
562 * M_HERE = the matched container will be replaced by the window
563 * (layout saving)
564 * M_ASSIGN_WS = the matched container will be inserted in the target_ws.
565 * M_BELOW = the window will be inserted as a child of the matched container
566 * (dockareas)
567 *
568 */
569 enum { M_HERE = 0,
571 M_BELOW } insert_where;
572
574 matches;
575
576 /* Whether this match was generated when restarting i3 inplace.
577 * Leads to not setting focus when managing a new window, because the old
578 * focus stack should be restored. */
579 bool restart_mode;
580};
581
602 enum {
603 A_ANY = 0,
604 A_COMMAND = (1 << 0),
605 A_TO_WORKSPACE = (1 << 1),
606 A_NO_FOCUS = (1 << 2),
607 A_TO_WORKSPACE_NUMBER = (1 << 3),
608 A_TO_OUTPUT = (1 << 4)
609 } type;
610
613
615 union {
616 char *command;
618 char *output;
619 } dest;
620
623};
624
626typedef enum { CF_NONE = 0,
629
630struct mark_t {
631 char *name;
632
635};
636
641struct Con {
642 bool mapped;
643
644 /* Should this container be marked urgent? This gets set when the window
645 * inside this container (if any) sets the urgency hint, for example. */
646 bool urgent;
647
654
655 /* The surface used for the frame window. */
659
660 enum {
661 CT_ROOT = 0,
662 CT_OUTPUT = 1,
663 CT_CON = 2,
664 CT_FLOATING_CON = 3,
665 CT_WORKSPACE = 4,
666 CT_DOCKAREA = 5
667 } type;
668
671 int num;
672
673 struct Con *parent;
674
675 /* The position and size for this con. These coordinates are absolute. Note
676 * that the rect of a container does not include the decoration. */
677 struct Rect rect;
678 /* The position and size of the actual client window. These coordinates are
679 * relative to the container's rect. */
680 struct Rect window_rect;
681 /* The position and size of the container's decoration. These coordinates
682 * are relative to the container's parent's rect. */
683 struct Rect deco_rect;
685 struct Rect geometry;
686
687 char *name;
688
691
692 /* a sticky-group is an identifier which bundles several containers to a
693 * group. The contents are shared between all of them, that is they are
694 * displayed on whichever of the containers is currently visible */
696
697 /* user-definable marks to jump to this container later */
698 TAILQ_HEAD(marks_head, mark_t)
699 marks_head;
700 /* cached to decide whether a redraw is needed */
701 bool mark_changed;
702
703 double percent;
704
705 /* the x11 border pixel attribute */
706 int border_width;
707 int current_border_width;
708
709 struct Window *window;
710
711 /* timer used for disabling urgency */
712 struct ev_timer *urgency_timer;
713
716
717 /* Only workspace-containers can have floating clients */
718 TAILQ_HEAD(floating_head, Con)
719 floating_head;
720
721 TAILQ_HEAD(nodes_head, Con)
722 nodes_head;
723
724 TAILQ_HEAD(focus_head, Con)
725 focus_head;
726
727 TAILQ_HEAD(swallow_head, Match)
728 swallow_head;
729
730 fullscreen_mode_t fullscreen_mode;
731
732 /* Whether this window should stick to the glass. This corresponds to
733 * the _NET_WM_STATE_STICKY atom and will only be respected if the
734 * window is floating. */
735 bool sticky;
736
737 /* layout is the layout of this container: one of split[v|h], stacked or
738 * tabbed. Special containers in the tree (above workspaces) have special
739 * layouts like dockarea or output.
740 *
741 * last_split_layout is one of splitv or splith to support the old "layout
742 * default" command which by now should be "layout splitv" or "layout
743 * splith" explicitly.
744 *
745 * workspace_layout is only for type == CT_WORKSPACE cons. When you change
746 * the layout of a workspace without any children, i3 cannot just set the
747 * layout (because workspaces need to be splitv/splith to allow focus
748 * parent and opening new containers). Instead, it stores the requested
749 * layout in workspace_layout and creates a new split container with that
750 * layout whenever a new container is attached to the workspace. */
751 layout_t layout, last_split_layout, workspace_layout;
752 border_style_t border_style;
759 enum {
760 FLOATING_AUTO_OFF = 0,
761 FLOATING_USER_OFF = 1,
762 FLOATING_AUTO_ON = 2,
763 FLOATING_USER_ON = 3
764 } floating;
765
767 nodes;
768
771
774
776 floating_windows;
777
779 void (*on_remove_child)(Con *);
780
781 enum {
782 /* Not a scratchpad window. */
783 SCRATCHPAD_NONE = 0,
784
785 /* Just moved to scratchpad, not resized by the user yet.
786 * Window will be auto-centered and sized appropriately. */
787 SCRATCHPAD_FRESH = 1,
788
789 /* The user changed position/size of the scratchpad window. */
790 SCRATCHPAD_CHANGED = 2
791 } scratchpad_state;
792
793 /* The ID of this container before restarting. Necessary to correctly
794 * interpret back-references in the JSON (such as the focus stack). */
796
797 /* Depth of the container window */
798 uint16_t depth;
799
800 /* The colormap for this con if a custom one is used. */
801 xcb_colormap_t colormap;
802};
struct pending_marks * marks
struct Con * focused
Definition: tree.c:13
struct all_cons_head all_cons
Definition: tree.c:15
struct outputs_head outputs
Definition: randr.c:21
struct autostarts_always_head autostarts_always
Definition: main.c:80
struct autostarts_head autostarts
Definition: main.c:77
struct assignments_head assignments
Definition: main.c:83
struct bindings_head * bindings
Definition: main.c:74
#define TAILQ_HEAD(name, type)
Definition: queue.h:318
#define SLIST_ENTRY(type)
Definition: queue.h:101
#define SLIST_HEAD(name, type)
Definition: queue.h:93
#define TAILQ_ENTRY(type)
Definition: queue.h:327
struct _i3String i3String
Opaque data structure for storing strings.
Definition: libi3.h:48
hide_edge_borders_mode_t
Definition: data.h:81
@ HEBM_VERTICAL
Definition: data.h:82
@ HEBM_HORIZONTAL
Definition: data.h:83
@ HEBM_BOTH
Definition: data.h:84
@ HEBM_SMART
Definition: data.h:85
@ HEBM_NONE
Definition: data.h:81
i3_xkb_group_mask_t
Bitmask for matching XCB_XKB_GROUP_1 to XCB_XKB_GROUP_4.
Definition: data.h:114
@ I3_XKB_GROUP_MASK_2
Definition: data.h:117
@ I3_XKB_GROUP_MASK_3
Definition: data.h:118
@ I3_XKB_GROUP_MASK_4
Definition: data.h:119
@ I3_XKB_GROUP_MASK_1
Definition: data.h:116
@ I3_XKB_GROUP_MASK_ANY
Definition: data.h:115
position_t
Definition: data.h:62
@ AFTER
Definition: data.h:63
@ BEFORE
Definition: data.h:62
uint32_t i3_event_state_mask_t
The lower 16 bits contain a xcb_key_but_mask_t, the higher 16 bits contain an i3_xkb_group_mask_t.
Definition: data.h:128
warping_t
Mouse pointer warping modes.
Definition: data.h:133
@ POINTER_WARPING_OUTPUT
Definition: data.h:134
@ POINTER_WARPING_NONE
Definition: data.h:135
layout_t
Container layouts.
Definition: data.h:93
@ L_STACKED
Definition: data.h:95
@ L_TABBED
Definition: data.h:96
@ L_DOCKAREA
Definition: data.h:97
@ L_OUTPUT
Definition: data.h:98
@ L_SPLITH
Definition: data.h:100
@ L_SPLITV
Definition: data.h:99
@ L_DEFAULT
Definition: data.h:94
mark_mode_t
Definition: data.h:87
@ MM_ADD
Definition: data.h:88
@ MM_REPLACE
Definition: data.h:87
focus_wrapping_t
Focus wrapping modes.
Definition: data.h:141
@ FOCUS_WRAPPING_OFF
Definition: data.h:142
@ FOCUS_WRAPPING_ON
Definition: data.h:143
@ FOCUS_WRAPPING_FORCE
Definition: data.h:144
@ FOCUS_WRAPPING_WORKSPACE
Definition: data.h:145
orientation_t
Definition: data.h:59
@ VERT
Definition: data.h:61
@ HORIZ
Definition: data.h:60
@ NO_ORIENTATION
Definition: data.h:59
adjacent_t
describes if the window is adjacent to the output (physical screen) edges.
Definition: data.h:75
@ ADJ_LEFT_SCREEN_EDGE
Definition: data.h:76
@ ADJ_LOWER_SCREEN_EDGE
Definition: data.h:79
@ ADJ_RIGHT_SCREEN_EDGE
Definition: data.h:77
@ ADJ_UPPER_SCREEN_EDGE
Definition: data.h:78
@ ADJ_NONE
Definition: data.h:75
fullscreen_mode_t
Fullscreen modes.
Definition: data.h:626
@ CF_OUTPUT
Definition: data.h:627
@ CF_GLOBAL
Definition: data.h:628
@ CF_NONE
Definition: data.h:626
border_style_t
Definition: data.h:64
@ BS_NONE
Definition: data.h:65
@ BS_PIXEL
Definition: data.h:66
@ BS_NORMAL
Definition: data.h:64
input_type_t
Binding input types.
Definition: data.h:106
@ B_KEYBOARD
Definition: data.h:107
@ B_MOUSE
Definition: data.h:108
kill_window_t
parameter to specify whether tree_close_internal() and x_window_kill() should kill only this specific...
Definition: data.h:70
@ KILL_CLIENT
Definition: data.h:72
@ KILL_WINDOW
Definition: data.h:71
@ DONT_KILL_WINDOW
Definition: data.h:70
qube_label_t
Qubes colors.
Definition: data.h:151
@ QUBE_ORANGE
Definition: data.h:154
@ QUBE_DOM0
Definition: data.h:152
@ QUBE_BLUE
Definition: data.h:158
@ QUBE_YELLOW
Definition: data.h:155
@ QUBE_GRAY
Definition: data.h:157
@ QUBE_GREEN
Definition: data.h:156
@ QUBE_RED
Definition: data.h:153
@ QUBE_PURPLE
Definition: data.h:159
@ QUBE_BLACK
Definition: data.h:160
direction_t
Definition: data.h:55
@ D_RIGHT
Definition: data.h:56
@ D_LEFT
Definition: data.h:55
@ D_UP
Definition: data.h:57
@ D_DOWN
Definition: data.h:58
Part of the struct Config.
Definition: configuration.h:54
Stores a rectangle, for example the size of a window, the child window etc.
Definition: data.h:175
uint32_t height
Definition: data.h:179
uint32_t x
Definition: data.h:176
uint32_t y
Definition: data.h:177
uint32_t width
Definition: data.h:178
Stores the reserved pixels on each screen edge read from a _NET_WM_STRUT_PARTIAL.
Definition: data.h:187
uint32_t top
Definition: data.h:190
uint32_t bottom
Definition: data.h:191
uint32_t right
Definition: data.h:189
uint32_t left
Definition: data.h:188
Stores a width/height pair, used as part of deco_render_params to check whether the rects width/heigh...
Definition: data.h:199
uint32_t w
Definition: data.h:200
uint32_t h
Definition: data.h:201
Stores the parameters for rendering a window decoration.
Definition: data.h:210
int border_style
Definition: data.h:212
struct Colortriple * color
Definition: data.h:211
bool con_is_leaf
Definition: data.h:218
color_t background
Definition: data.h:216
layout_t parent_layout
Definition: data.h:217
struct width_height con_rect
Definition: data.h:213
Rect con_deco_rect
Definition: data.h:215
struct width_height con_window_rect
Definition: data.h:214
Stores which workspace (by name or number) goes to which output.
Definition: data.h:225
int sequence
Definition: data.h:234
time_t added
Definition: data.h:236
int response_type
Definition: data.h:235
Stores internal information about a startup sequence, like the workspace it was initiated on.
Definition: data.h:247
char * id
startup ID for this sequence, generated by libstartup-notification
Definition: data.h:249
time_t delete_at
time at which this sequence should be deleted (after it was marked as completed)
Definition: data.h:256
char * workspace
workspace on which this startup was initiated
Definition: data.h:251
SnLauncherContext * context
libstartup-notification context for this launch
Definition: data.h:253
Regular expression wrapper.
Definition: data.h:271
pcre_extra * extra
Definition: data.h:274
pcre * regex
Definition: data.h:273
char * pattern
Definition: data.h:272
Stores a resolved keycode (from a keysym), including the modifier mask.
Definition: data.h:282
i3_event_state_mask_t modifiers
Definition: data.h:284
xcb_keycode_t keycode
Definition: data.h:283
Holds a keybinding, consisting of a keycode combined with modifiers and the command which is executed...
Definition: data.h:300
bool whole_window
If this is true for a mouse binding, the binding should be executed when the button is pressed over a...
Definition: data.h:326
bool border
If this is true for a mouse binding, the binding should be executed when the button is pressed over t...
Definition: data.h:321
uint32_t keycode
Keycode to bind.
Definition: data.h:333
char * symbol
Symbol the user specified in configfile, if any.
Definition: data.h:343
bool exclude_titlebar
If this is true for a mouse binding, the binding should only be executed if the button press was not ...
Definition: data.h:330
i3_event_state_mask_t event_state_mask
Bitmask which is applied against event->state for KeyPress and KeyRelease events to determine whether...
Definition: data.h:338
input_type_t input_type
Definition: data.h:303
Holds a command specified by either an:
Definition: data.h:365
bool no_startup_id
no_startup_id flag for start_application().
Definition: data.h:370
char * command
Command, like in command mode.
Definition: data.h:367
char * name
Definition: data.h:380
An Output is a physical output on your graphics driver.
Definition: data.h:393
bool changed
Internal flags, necessary for querying RandR screens (happens in two stages)
Definition: data.h:403
bool to_be_disabled
Definition: data.h:404
bool active
Whether the output is currently active (has a CRTC attached with a valid mode)
Definition: data.h:399
xcb_randr_output_t id
Output id, so that we can requery the output directly later.
Definition: data.h:395
bool primary
Definition: data.h:405
A 'Window' is a type which contains an xcb_window_t and all the related information (hints like _NET_...
Definition: data.h:428
double max_aspect_ratio
Definition: data.h:510
time_t managed_since
Definition: data.h:519
char * class_instance
Definition: data.h:442
i3String * qubes_vmname
The name of the qubes vm.
Definition: data.h:448
bool uses_net_wm_name
Whether the application used _NET_WM_NAME.
Definition: data.h:462
bool input_shaped
The window has a nonrectangular input shape.
Definition: data.h:515
int base_height
Definition: data.h:494
i3String * name
The name of the window.
Definition: data.h:445
int height_increment
Definition: data.h:498
int max_height
Definition: data.h:506
double min_aspect_ratio
Definition: data.h:509
bool name_x_changed
Flag to force re-rendering the decoration upon changes.
Definition: data.h:459
int max_width
Definition: data.h:505
xcb_window_t id
Definition: data.h:429
int qubes_label
The qubes label.
Definition: data.h:451
int min_height
Definition: data.h:502
xcb_atom_t window_type
The _NET_WM_WINDOW_TYPE for this window.
Definition: data.h:472
Assignment ** ran_assignments
Definition: data.h:439
bool doesnt_accept_focus
Whether this window accepts focus.
Definition: data.h:469
bool shaped
The window has a nonrectangular shape.
Definition: data.h:513
int width_increment
Definition: data.h:497
bool needs_take_focus
Whether the application needs to receive WM_TAKE_FOCUS.
Definition: data.h:465
char * class_class
Definition: data.h:441
xcb_window_t transient_for
Definition: data.h:434
char * role
The WM_WINDOW_ROLE of this window (for example, the pidgin buddy window sets "buddy list").
Definition: data.h:456
uint32_t wm_desktop
The _NET_WM_DESKTOP for this window.
Definition: data.h:475
int base_width
Definition: data.h:493
xcb_window_t leader
Holds the xcb_window_t (just an ID) for the leader window (logical parent for toolwindows and similar...
Definition: data.h:433
uint16_t depth
Depth of the window.
Definition: data.h:489
int min_width
Definition: data.h:501
uint32_t nr_assignments
Pointers to the Assignments which were already ran for this Window (assignments run only once)
Definition: data.h:438
A "match" is a data structure which acts like a mask or expression to match certain windows or not.
Definition: data.h:530
struct regex * window_role
Definition: data.h:539
xcb_atom_t window_type
Definition: data.h:541
@ WM_TILING
Definition: data.h:556
struct regex * title
Definition: data.h:534
struct regex * instance
Definition: data.h:537
struct regex * application
Definition: data.h:535
@ M_ASSIGN_WS
Definition: data.h:570
struct regex * mark
Definition: data.h:538
struct regex * workspace
Definition: data.h:540
xcb_window_t id
Definition: data.h:554
Con * con_id
Definition: data.h:558
char * error
Definition: data.h:532
An Assignment makes specific windows go to a specific workspace/output or run a command for that wind...
Definition: data.h:590
Match match
the criteria to check if a window matches
Definition: data.h:612
char * output
Definition: data.h:618
char * command
Definition: data.h:616
char * workspace
Definition: data.h:617
Definition: data.h:630
char * name
Definition: data.h:631
A 'Con' represents everything from the X11 root window down to a single X11 window.
Definition: data.h:641
struct Con * parent
Definition: data.h:673
xcb_colormap_t colormap
Definition: data.h:801
bool pixmap_recreated
Definition: data.h:658
bool mapped
Definition: data.h:642
int num
the workspace number, if this Con is of type CT_WORKSPACE and the workspace is not a named workspace ...
Definition: data.h:671
uint8_t ignore_unmap
This counter contains the number of UnmapNotify events for this container (or, more precisely,...
Definition: data.h:653
int old_id
Definition: data.h:795
char * title_format
The format with which the window's name should be displayed.
Definition: data.h:690
surface_t frame
Definition: data.h:656
char * name
Definition: data.h:687
char * sticky_group
Definition: data.h:695
uint16_t depth
Definition: data.h:798
surface_t frame_buffer
Definition: data.h:657
bool urgent
Definition: data.h:646
Definition: libi3.h:413