14 #include <sys/types.h>
15 #include <sys/socket.h>
18 #include <sys/resource.h>
24 #ifdef I3_ASAN_ENABLED
25 #include <sanitizer/lsan_interface.h>
97 #define xmacro(atom) xcb_atom_t A_##atom;
98 #include "atoms.xmacro"
119 xcb_generic_event_t *event;
121 while ((event = xcb_poll_for_event(
conn)) != NULL) {
122 if (event->response_type == 0) {
124 DLOG(
"Expected X11 Error received for sequence %x\n", event->sequence);
126 xcb_generic_error_t *error = (xcb_generic_error_t *)event;
127 DLOG(
"X11 Error received (probably harmless)! sequence 0x%x, error_code = %d\n",
128 error->sequence, error->error_code);
135 int type = (
event->response_type & 0x7F);
153 DLOG(
"Setting main X11 callback to enabled=%d\n", enable);
170 fprintf(stderr,
"Closing SHM log \"%s\"\n",
shmlogname);
176 xcb_disconnect(
conn);
181 #if EV_VERSION_MAJOR >= 4
185 #ifdef I3_ASAN_ENABLED
186 __lsan_do_leak_check();
212 exit(128 + signal->signum);
220 static struct ev_signal signal_watchers[6];
221 size_t num_watchers =
sizeof(signal_watchers) /
sizeof(signal_watchers[0]);
235 for (
size_t i = 0; i < num_watchers; i++) {
236 ev_signal_start(
main_loop, &signal_watchers[i]);
245 const char *restart_fd = getenv(
"_I3_RESTART_FD");
246 if (restart_fd == NULL) {
252 ELOG(
"Malformed _I3_RESTART_FD \"%s\"\n", restart_fd);
258 int main(
int argc,
char *argv[]) {
261 static const char *_i3_version
__attribute__((used)) = I3_VERSION;
262 char *override_configpath = NULL;
263 bool autostart =
true;
264 char *layout_path = NULL;
265 bool delete_layout_path =
false;
266 bool disable_randr15 =
false;
267 char *fake_outputs = NULL;
268 bool disable_signalhandler =
false;
270 static struct option long_options[] = {
271 {
"no-autostart", no_argument, 0,
'a'},
272 {
"config", required_argument, 0,
'c'},
273 {
"version", no_argument, 0,
'v'},
274 {
"moreversion", no_argument, 0,
'm'},
275 {
"more-version", no_argument, 0,
'm'},
276 {
"more_version", no_argument, 0,
'm'},
277 {
"help", no_argument, 0,
'h'},
278 {
"layout", required_argument, 0,
'L'},
279 {
"restart", required_argument, 0, 0},
280 {
"force-xinerama", no_argument, 0, 0},
281 {
"force_xinerama", no_argument, 0, 0},
282 {
"disable-randr15", no_argument, 0, 0},
283 {
"disable_randr15", no_argument, 0, 0},
284 {
"disable-signalhandler", no_argument, 0, 0},
285 {
"shmlog-size", required_argument, 0, 0},
286 {
"shmlog_size", required_argument, 0, 0},
287 {
"get-socketpath", no_argument, 0, 0},
288 {
"get_socketpath", no_argument, 0, 0},
289 {
"fake_outputs", required_argument, 0, 0},
290 {
"fake-outputs", required_argument, 0, 0},
291 {
"force-old-config-parser-v4.4-only", no_argument, 0, 0},
293 int option_index = 0, opt;
295 setlocale(LC_ALL,
"");
302 if (!isatty(fileno(stdout)))
303 setbuf(stdout, NULL);
316 while ((opt = getopt_long(argc, argv,
"c:CvmaL:hld:V", long_options, &option_index)) != -1) {
319 LOG(
"Autostart disabled using -a\n");
325 delete_layout_path =
false;
328 FREE(override_configpath);
329 override_configpath =
sstrdup(optarg);
332 LOG(
"Checking configuration file only (-C)\n");
336 printf(
"i3 version %s © 2009 Michael Stapelberg and contributors\n",
i3_version);
340 printf(
"Binary i3 version: %s © 2009 Michael Stapelberg and contributors\n",
i3_version);
348 LOG(
"Enabling debug logging\n");
355 if (strcmp(long_options[option_index].name,
"force-xinerama") == 0 ||
356 strcmp(long_options[option_index].name,
"force_xinerama") == 0) {
358 ELOG(
"Using Xinerama instead of RandR. This option should be "
359 "avoided at all cost because it does not refresh the list "
360 "of screens, so you cannot configure displays at runtime. "
361 "Please check if your driver really does not support RandR "
362 "and disable this option as soon as you can.\n");
364 }
else if (strcmp(long_options[option_index].name,
"disable-randr15") == 0 ||
365 strcmp(long_options[option_index].name,
"disable_randr15") == 0) {
366 disable_randr15 =
true;
368 }
else if (strcmp(long_options[option_index].name,
"disable-signalhandler") == 0) {
369 disable_signalhandler =
true;
371 }
else if (strcmp(long_options[option_index].name,
"get-socketpath") == 0 ||
372 strcmp(long_options[option_index].name,
"get_socketpath") == 0) {
375 printf(
"%s\n", socket_path);
380 }
else if (strcmp(long_options[option_index].name,
"shmlog-size") == 0 ||
381 strcmp(long_options[option_index].name,
"shmlog_size") == 0) {
388 }
else if (strcmp(long_options[option_index].name,
"restart") == 0) {
391 delete_layout_path =
true;
393 }
else if (strcmp(long_options[option_index].name,
"fake-outputs") == 0 ||
394 strcmp(long_options[option_index].name,
"fake_outputs") == 0) {
395 LOG(
"Initializing fake outputs: %s\n", optarg);
396 fake_outputs =
sstrdup(optarg);
398 }
else if (strcmp(long_options[option_index].name,
"force-old-config-parser-v4.4-only") == 0) {
399 ELOG(
"You are passing --force-old-config-parser-v4.4-only, but that flag was removed by now.\n");
404 fprintf(stderr,
"Usage: %s [-c configfile] [-d all] [-a] [-v] [-V] [-C]\n", argv[0]);
405 fprintf(stderr,
"\n");
406 fprintf(stderr,
"\t-a disable autostart ('exec' lines in config)\n");
407 fprintf(stderr,
"\t-c <file> use the provided configfile instead\n");
408 fprintf(stderr,
"\t-C validate configuration file and exit\n");
409 fprintf(stderr,
"\t-d all enable debug output\n");
410 fprintf(stderr,
"\t-L <file> path to the serialized layout during restarts\n");
411 fprintf(stderr,
"\t-v display version and exit\n");
412 fprintf(stderr,
"\t-V enable verbose mode\n");
413 fprintf(stderr,
"\n");
414 fprintf(stderr,
"\t--force-xinerama\n"
415 "\tUse Xinerama instead of RandR.\n"
416 "\tThis option should only be used if you are stuck with the\n"
417 "\told nVidia closed source driver (older than 302.17), which does\n"
418 "\tnot support RandR.\n");
419 fprintf(stderr,
"\n");
420 fprintf(stderr,
"\t--get-socketpath\n"
421 "\tRetrieve the i3 IPC socket path from X11, print it, then exit.\n");
422 fprintf(stderr,
"\n");
423 fprintf(stderr,
"\t--shmlog-size <limit>\n"
424 "\tLimits the size of the i3 SHM log to <limit> bytes. Setting this\n"
425 "\tto 0 disables SHM logging entirely.\n"
426 "\tThe default is %d bytes.\n",
428 fprintf(stderr,
"\n");
429 fprintf(stderr,
"If you pass plain text arguments, i3 will interpret them as a command\n"
430 "to send to a currently running i3 (like i3-msg). This allows you to\n"
431 "use nice and logical commands, such as:\n"
434 "\ti3 floating toggle\n"
437 exit(opt ==
'h' ? EXIT_SUCCESS : EXIT_FAILURE);
454 LOG(
"Additional arguments passed. Sending them as a command to i3.\n");
455 char *payload = NULL;
456 while (optind < argc) {
458 payload =
sstrdup(argv[optind]);
461 sasprintf(&both,
"%s %s", payload, argv[optind]);
467 DLOG(
"Command is: %s (%zd bytes)\n", payload, strlen(payload));
470 ELOG(
"Could not get i3 IPC socket path\n");
474 int sockfd = socket(AF_LOCAL, SOCK_STREAM, 0);
476 err(EXIT_FAILURE,
"Could not create socket");
478 struct sockaddr_un addr;
479 memset(&addr, 0,
sizeof(
struct sockaddr_un));
480 addr.sun_family = AF_LOCAL;
481 strncpy(addr.sun_path, socket_path,
sizeof(addr.sun_path) - 1);
483 if (connect(sockfd, (
const struct sockaddr *)&addr,
sizeof(
struct sockaddr_un)) < 0)
484 err(EXIT_FAILURE,
"Could not connect to i3");
486 if (
ipc_send_message(sockfd, strlen(payload), I3_IPC_MESSAGE_TYPE_RUN_COMMAND,
487 (uint8_t *)payload) == -1)
488 err(EXIT_FAILURE,
"IPC: write()");
491 uint32_t reply_length;
495 if ((ret =
ipc_recv_message(sockfd, &reply_type, &reply_length, &reply)) != 0) {
497 err(EXIT_FAILURE,
"IPC: read()");
500 if (reply_type != I3_IPC_REPLY_TYPE_COMMAND)
501 errx(EXIT_FAILURE,
"IPC: received reply of type %d but expected %d (COMMAND)", reply_type, I3_IPC_REPLY_TYPE_COMMAND);
502 printf(
"%.*s\n", reply_length, reply);
512 struct rlimit limit = {RLIM_INFINITY, RLIM_INFINITY};
513 setrlimit(RLIMIT_CORE, &limit);
517 LOG(
"CORE DUMPS: You are running a development version of i3, so coredumps were automatically enabled (ulimit -c unlimited).\n");
518 size_t cwd_size = 1024;
521 while ((cwd_ret = getcwd(cwd, cwd_size)) == NULL && errno == ERANGE) {
522 cwd_size = cwd_size * 2;
526 LOG(
"CORE DUMPS: Your current working directory is \"%s\".\n", cwd);
528 if ((patternfd = open(
"/proc/sys/kernel/core_pattern", O_RDONLY)) >= 0) {
529 memset(cwd,
'\0', cwd_size);
530 if (read(patternfd, cwd, cwd_size) > 0)
532 LOG(
"CORE DUMPS: Your core_pattern is: %s", cwd);
541 if (xcb_connection_has_error(
conn))
542 errx(EXIT_FAILURE,
"Cannot open display");
551 die(
"Could not initialize libev. Bad LIBEV_FLAGS?\n");
557 #define xmacro(atom) \
558 xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom);
559 #include "atoms.xmacro"
569 xcb_void_cookie_t cm_cookie = xcb_create_colormap_checked(
conn,
570 XCB_COLORMAP_ALLOC_NONE,
575 xcb_generic_error_t *error = xcb_request_check(
conn, cm_cookie);
577 ELOG(
"Could not create colormap. Error code: %d\n", error->error_code);
587 DLOG(
"root_screen->height_in_pixels = %d, root_screen->height_in_millimeters = %d\n",
589 DLOG(
"One logical pixel corresponds to %d physical pixels on this display.\n",
logical_px(1));
591 xcb_get_geometry_cookie_t gcookie = xcb_get_geometry(
conn,
root);
592 xcb_query_pointer_cookie_t pointercookie = xcb_query_pointer(
conn,
root);
595 #define xmacro(name) \
597 xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(conn, name##_cookie, NULL); \
599 ELOG("Could not get atom " #name "\n"); \
602 A_##name = reply->atom; \
605 #include "atoms.xmacro"
622 xcb_void_cookie_t cookie;
624 xcb_generic_error_t *error = xcb_request_check(
conn, cookie);
626 ELOG(
"Another window manager seems to be running (X error %d)\n", error->error_code);
627 #ifdef I3_ASAN_ENABLED
628 __lsan_do_leak_check();
633 xcb_get_geometry_reply_t *greply = xcb_get_geometry_reply(
conn, gcookie, NULL);
634 if (greply == NULL) {
635 ELOG(
"Could not get geometry of the root window, exiting\n");
638 DLOG(
"root geometry reply: (%d, %d) %d x %d\n", greply->x, greply->y, greply->width, greply->height);
649 const xcb_query_extension_reply_t *extreply;
650 xcb_prefetch_extension_data(
conn, &xcb_xkb_id);
651 xcb_prefetch_extension_data(
conn, &xcb_shape_id);
653 extreply = xcb_get_extension_data(
conn, &xcb_xkb_id);
655 if (!extreply->present) {
656 DLOG(
"xkb is not present on this server\n");
658 DLOG(
"initializing xcb-xkb\n");
659 xcb_xkb_use_extension(
conn, XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION);
660 xcb_xkb_select_events(
conn,
661 XCB_XKB_ID_USE_CORE_KBD,
662 XCB_XKB_EVENT_TYPE_STATE_NOTIFY | XCB_XKB_EVENT_TYPE_MAP_NOTIFY | XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY,
664 XCB_XKB_EVENT_TYPE_STATE_NOTIFY | XCB_XKB_EVENT_TYPE_MAP_NOTIFY | XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY,
679 const uint32_t mask = XCB_XKB_PER_CLIENT_FLAG_GRABS_USE_XKB_STATE |
680 XCB_XKB_PER_CLIENT_FLAG_LOOKUP_STATE_WHEN_GRABBED |
681 XCB_XKB_PER_CLIENT_FLAG_DETECTABLE_AUTO_REPEAT;
682 xcb_xkb_per_client_flags_reply_t *pcf_reply;
687 pcf_reply = xcb_xkb_per_client_flags_reply(
689 xcb_xkb_per_client_flags(
691 XCB_XKB_ID_USE_CORE_KBD,
699 #define PCF_REPLY_ERROR(_value) \
701 if (pcf_reply == NULL || !(pcf_reply->value & (_value))) { \
702 ELOG("Could not set " #_value "\n"); \
716 extreply = xcb_get_extension_data(
conn, &xcb_shape_id);
717 if (extreply->present) {
719 xcb_shape_query_version_cookie_t cookie = xcb_shape_query_version(
conn);
720 xcb_shape_query_version_reply_t *version =
721 xcb_shape_query_version_reply(
conn, cookie, NULL);
728 DLOG(
"shape 1.1 is not present on this server\n");
742 die(
"Could not load keymap\n");
747 bool needs_tree_init =
true;
748 if (layout_path != NULL) {
749 LOG(
"Trying to restore the layout from \"%s\".\n", layout_path);
751 if (delete_layout_path) {
753 const char *dir = dirname(layout_path);
768 if (fake_outputs != NULL) {
778 DLOG(
"Checking for XRandR...\n");
797 if (output->
con == NULL) {
811 xcb_query_pointer_reply_t *pointerreply;
813 if (!(pointerreply = xcb_query_pointer_reply(
conn, pointercookie, NULL))) {
814 ELOG(
"Could not query pointer position, using first screen\n");
816 DLOG(
"Pointer at %d, %d\n", pointerreply->root_x, pointerreply->root_y);
819 ELOG(
"ERROR: No screen at (%d, %d), starting on the first screen\n",
820 pointerreply->root_x, pointerreply->root_y);
833 if (ipc_socket == -1) {
834 ELOG(
"Could not create the IPC socket, IPC disabled\n");
836 struct ev_io *ipc_io =
scalloc(1,
sizeof(
struct ev_io));
846 ELOG(
"socket activation: Error in sd_listen_fds\n");
848 DLOG(
"socket activation: no sockets passed\n");
854 DLOG(
"socket activation: also listening on fd %d\n", fd);
859 if ((flags = fcntl(fd, F_GETFD)) < 0 ||
860 fcntl(fd, F_SETFD, flags & ~FD_CLOEXEC) < 0) {
861 ELOG(
"Could not disable FD_CLOEXEC on fd %d\n", fd);
864 struct ev_io *ipc_io =
scalloc(1,
sizeof(
struct ev_io));
872 if (restart_fd != -1) {
873 DLOG(
"serving restart fd %d", restart_fd);
876 unsetenv(
"_I3_RESTART_FD");
887 struct ev_io *xcb_watcher =
scalloc(1,
sizeof(
struct ev_io));
911 xcb_grab_server(
conn);
914 xcb_generic_event_t *event;
915 while ((event = xcb_poll_for_event(
conn)) != NULL) {
916 if (event->response_type == 0) {
922 int type = (
event->response_type & 0x7F);
927 if (type == XCB_MAP_REQUEST)
934 xcb_ungrab_server(
conn);
937 LOG(
"This is not an in-place restart, copying root window contents to a pixmap\n");
939 uint16_t width =
root->width_in_pixels;
940 uint16_t height =
root->height_in_pixels;
941 xcb_pixmap_t pixmap = xcb_generate_id(
conn);
942 xcb_gcontext_t gc = xcb_generate_id(
conn);
944 xcb_create_pixmap(
conn,
root->root_depth, pixmap,
root->root, width, height);
947 XCB_GC_FUNCTION | XCB_GC_PLANE_MASK | XCB_GC_FILL_STYLE | XCB_GC_SUBWINDOW_MODE,
948 (uint32_t[]){XCB_GX_COPY, ~0, XCB_FILL_STYLE_SOLID, XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS});
950 xcb_copy_area(
conn,
root->root, pixmap, gc, 0, 0, 0, 0, width, height);
951 xcb_change_window_attributes(
conn,
root->root, XCB_CW_BACK_PIXMAP, (uint32_t[]){pixmap});
953 xcb_free_gc(
conn, gc);
954 xcb_free_pixmap(
conn, pixmap);
957 #if defined(__OpenBSD__)
958 if (pledge(
"stdio rpath wpath cpath proc exec unix", NULL) == -1)
959 err(EXIT_FAILURE,
"pledge");
962 if (!disable_signalhandler)
965 struct sigaction action;
968 action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;
969 sigemptyset(&action.sa_mask);
972 if (sigaction(SIGQUIT, &action, NULL) == -1 ||
973 sigaction(SIGILL, &action, NULL) == -1 ||
974 sigaction(SIGABRT, &action, NULL) == -1 ||
975 sigaction(SIGFPE, &action, NULL) == -1 ||
976 sigaction(SIGSEGV, &action, NULL) == -1)
977 ELOG(
"Could not setup signal handler.\n");
983 signal(SIGPIPE, SIG_IGN);
1003 LOG(
"auto-starting (always!) %s\n", exec_always->
command);
1017 barconfig->
verbose ?
"-V" :
"",
bool load_keymap(void)
Loads the XKB keymap from the X11 server and feeds it to xkbcommon.
void grab_all_keys(xcb_connection_t *conn)
Grab the bound keys (tell X to send us keypress events for those keycodes)
void translate_keysyms(void)
Translates keysymbols to keycodes for all bindings which use keysyms.
Con * con_descend_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
void con_activate(Con *con)
Sets input focus to the given container and raises it to the top.
bool load_configuration(const char *override_configpath, config_load_t load_type)
(Re-)loads the configuration file (sets useful defaults before).
struct barconfig_head barconfigs
void display_running_version(void)
Connects to i3 to find out the currently running version.
void ewmh_setup_hints(void)
Set up the EWMH hints on the root window.
void ewmh_update_desktop_properties(void)
Updates all the EWMH desktop properties.
void ewmh_update_workarea(void)
i3 currently does not support _NET_WORKAREA, because it does not correspond to i3’s concept of worksp...
void fake_outputs_init(const char *output_spec)
Creates outputs according to the given specification.
void handle_event(int type, xcb_generic_event_t *event)
Takes an xcb_generic_event_t and calls the appropriate handler, based on the event type.
bool event_is_ignored(const int sequence, const int response_type)
Checks if the given sequence is ignored and returns true if so.
void property_handlers_init(void)
Sets the appropriate atoms for the property handlers after the atoms were received from X11.
int ipc_create_socket(const char *filename)
Creates the UNIX domain socket at the given path, sets it to non-blocking mode, bind()s and listen()s...
void ipc_confirm_restart(ipc_client *client)
Sends a restart reply to the IPC client on the specified fd.
ipc_client * ipc_new_client_on_fd(EV_P_ int fd)
ipc_new_client_on_fd() only sets up the event handler for activity on the new connection and inserts ...
char * current_socketpath
void ipc_shutdown(shutdown_reason_t reason, int exempt_fd)
Calls shutdown() on each socket and closes it.
void ipc_new_client(EV_P_ struct ev_io *w, int revents)
Handler for activity on the listening socket, meaning that a new client has just connected and we sho...
void init_logging(void)
Initializes logging by creating an error logfile in /tmp (or XDG_RUNTIME_DIR, see get_process_filenam...
void set_debug_logging(const bool _debug_logging)
Set debug logging.
void set_verbosity(bool _verbose)
Set verbosity of i3.
xcb_timestamp_t last_timestamp
The last timestamp we got from X11 (timestamps are included in some events and are used for some thin...
int main(int argc, char *argv[])
const int default_shmlog_size
#define PCF_REPLY_ERROR(_value)
static void handle_term_signal(struct ev_loop *loop, ev_signal *signal, int revents)
xcb_connection_t * conn
XCB connection and root screen.
static void xcb_got_event(EV_P_ struct ev_io *w, int revents)
int listen_fds
The number of file descriptors passed via socket activation.
xcb_key_symbols_t * keysyms
struct autostarts_always_head autostarts_always
static struct ev_prepare * xcb_prepare
static void i3_exit(void)
struct rlimit original_rlimit_core
The original value of RLIMIT_CORE when i3 was started.
xcb_screen_t * root_screen
static void setup_term_handlers(void)
xcb_visualtype_t * visual_type
static void handle_core_signal(int sig, siginfo_t *info, void *data)
void main_set_x11_cb(bool enable)
Enable or disable the main X11 event handling function.
struct autostarts_head autostarts
static int parse_restart_fd(void)
struct ev_loop * main_loop
static void xcb_prepare_cb(EV_P_ ev_prepare *w, int revents)
struct assignments_head assignments
struct ws_assignments_head ws_assignments
struct bindings_head * bindings
void manage_existing_windows(xcb_window_t root)
Go through all existing windows (if the window manager is restarted) and manage them.
char * output_primary_name(Output *output)
Retrieves the primary name of an output.
Con * output_get_content(Con *output)
Returns the output container below the given output container.
Output * get_first_output(void)
Returns the first output which is active.
void output_init_con(Output *output)
Initializes a CT_OUTPUT Con (searches existing ones from inplace restart before) to use for the given...
struct outputs_head outputs
void randr_init(int *event_base, const bool disable_randr15)
We have just established a connection to the X server and need the initial XRandR information to setu...
Output * get_output_containing(unsigned int x, unsigned int y)
Returns the active (!) output which contains the coordinates x, y or NULL if there is no output which...
void randr_disable_output(Output *output)
Disables the output and moves its content.
void restore_connect(void)
Opens a separate connection to X11 for placeholder windows when restoring layouts.
void scratchpad_fix_resolution(void)
When starting i3 initially (and after each change to the connected outputs), this function fixes the ...
int sd_listen_fds(int unset_environment)
void setup_signal_handler(void)
Configured a signal handler to gracefully handle crashes and allow the user to generate a backtrace a...
void start_application(const char *command, bool no_startup_id)
Starts the given application by passing it through a shell.
bool tree_restore(const char *path, xcb_get_geometry_reply_t *geometry)
Loads tree from ~/.i3/_restart.json (used for in-place restarts).
void tree_init(xcb_get_geometry_reply_t *geometry)
Initializes the tree by creating the root node, adding all RandR outputs to the tree (that means rand...
void tree_render(void)
Renders the tree, that is rendering all outputs using render_con() and pushing the changes to X11 usi...
bool parse_long(const char *str, long *out, int base)
Converts a string into a long using strtol().
const char * i3_version
Git commit identifier, from version.c.
void x_set_i3_atoms(void)
Sets up i3 specific atoms (I3_SOCKET_PATH and I3_CONFIG_PATH)
void xcb_set_root_cursor(int cursor)
Set the cursor of the root window to the given cursor id.
unsigned int xcb_numlock_mask
void xcursor_load_cursors(void)
void xcursor_set_root_cursor(int cursor_id)
Sets the cursor of the root window to the 'pointer' cursor.
void xinerama_init(void)
We have just established a connection to the X server and need the initial Xinerama information to se...
xcb_visualtype_t * get_visualtype(xcb_screen_t *screen)
Returns the visual type associated with the given screen.
char * sstrdup(const char *str)
Safe-wrapper around strdup which exits if malloc returns NULL (meaning that there is no more memory a...
int logical_px(const int logical)
Convert a logical amount of pixels (e.g.
char * get_process_filename(const char *prefix)
Returns the name of a temporary file with the specified prefix.
void * smalloc(size_t size)
Safe-wrapper around malloc which exits if malloc returns NULL (meaning that there is no more memory a...
char * root_atom_contents(const char *atomname, xcb_connection_t *provided_conn, int screen)
Try to get the contents of the given atom (for example I3_SOCKET_PATH) from the X11 root window and r...
int ipc_recv_message(int sockfd, uint32_t *message_type, uint32_t *reply_length, uint8_t **reply)
Reads a message from the given socket file descriptor and stores its length (reply_length) as well as...
uint32_t aio_get_mod_mask_for(uint32_t keysym, xcb_key_symbols_t *symbols)
All-in-one function which returns the modifier mask (XCB_MOD_MASK_*) for the given keysymbol,...
int sasprintf(char **strp, const char *fmt,...)
Safe-wrapper around asprintf which exits if it returns -1 (meaning that there is no more memory avail...
void * srealloc(void *ptr, size_t size)
Safe-wrapper around realloc which exits if realloc returns NULL (meaning that there is no more memory...
int ipc_send_message(int sockfd, const uint32_t message_size, const uint32_t message_type, const uint8_t *payload)
Formats a message (payload) of the given size and type and sends it to i3 via the given socket file d...
bool is_debug_build(void) __attribute__((const))
Returns true if this version of i3 is a debug build (anything which is not a release version),...
void init_dpi(void)
Initialize the DPI setting.
void * scalloc(size_t num, size_t size)
Safe-wrapper around calloc which exits if malloc returns NULL (meaning that there is no more memory a...
#define TAILQ_FOREACH(var, head, field)
#define TAILQ_FIRST(head)
#define TAILQ_REMOVE(head, elm, field)
#define TAILQ_HEAD_INITIALIZER(head)
#define TAILQ_EMPTY(head)
#define SD_LISTEN_FDS_START
char * fake_outputs
Overwrites output detection (for testing), see src/fake_outputs.c.
bool disable_randr15
Don’t use RandR 1.5 for querying outputs.
bool force_xinerama
By default, use the RandR API for multi-monitor setups.
Holds the status bar configuration (i3bar).
char * i3bar_command
Command that should be run to execute i3bar, give a full path if i3bar is not in your $PATH.
char * id
Automatically generated ID for this bar config.
bool verbose
Enable verbose mode? Useful for debugging purposes.
Holds a command specified by either an:
bool no_startup_id
no_startup_id flag for start_application().
char * command
Command, like in command mode.
An Output is a physical output on your graphics driver.
Con * con
Pointer to the Con which represents this output.
bool changed
Internal flags, necessary for querying RandR screens (happens in two stages)
bool active
Whether the output is currently active (has a CRTC attached with a valid mode)
A 'Con' represents everything from the X11 root window down to a single X11 window.