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> 114 xcb_generic_event_t *event;
116 while ((event = xcb_poll_for_event(
conn)) != NULL) {
117 if (event->response_type == 0) {
119 DLOG(
"Expected X11 Error received for sequence %x\n", event->sequence);
121 xcb_generic_error_t *error = (xcb_generic_error_t *)event;
122 DLOG(
"X11 Error received (probably harmless)! sequence 0x%x, error_code = %d\n",
123 error->sequence, error->error_code);
130 int type = (
event->response_type & 0x7F);
148 DLOG(
"Setting main X11 callback to enabled=%d\n", enable);
165 fprintf(stderr,
"Closing SHM log \"%s\"\n",
shmlogname);
171 xcb_disconnect(
conn);
176 #if EV_VERSION_MAJOR >= 4 180 #ifdef I3_ASAN_ENABLED 181 __lsan_do_leak_check();
207 exit(128 + signal->signum);
215 static struct ev_signal signal_watchers[6];
216 size_t num_watchers =
sizeof(signal_watchers) /
sizeof(signal_watchers[0]);
230 for (
size_t i = 0; i < num_watchers; i++) {
231 ev_signal_start(
main_loop, &signal_watchers[i]);
240 const char *restart_fd = getenv(
"_I3_RESTART_FD");
241 if (restart_fd == NULL) {
247 ELOG(
"Malformed _I3_RESTART_FD \"%s\"\n", restart_fd);
253 int main(
int argc,
char *argv[]) {
256 static const char *_i3_version
__attribute__((used)) = I3_VERSION;
257 char *override_configpath = NULL;
258 bool autostart =
true;
259 char *layout_path = NULL;
260 bool delete_layout_path =
false;
261 bool disable_randr15 =
false;
262 char *fake_outputs = NULL;
263 bool disable_signalhandler =
false;
265 static struct option long_options[] = {
266 {
"no-autostart", no_argument, 0,
'a'},
267 {
"config", required_argument, 0,
'c'},
268 {
"version", no_argument, 0,
'v'},
269 {
"moreversion", no_argument, 0,
'm'},
270 {
"more-version", no_argument, 0,
'm'},
271 {
"more_version", no_argument, 0,
'm'},
272 {
"help", no_argument, 0,
'h'},
273 {
"layout", required_argument, 0,
'L'},
274 {
"restart", required_argument, 0, 0},
275 {
"force-xinerama", no_argument, 0, 0},
276 {
"force_xinerama", no_argument, 0, 0},
277 {
"disable-randr15", no_argument, 0, 0},
278 {
"disable_randr15", no_argument, 0, 0},
279 {
"disable-signalhandler", no_argument, 0, 0},
280 {
"shmlog-size", required_argument, 0, 0},
281 {
"shmlog_size", required_argument, 0, 0},
282 {
"get-socketpath", no_argument, 0, 0},
283 {
"get_socketpath", no_argument, 0, 0},
284 {
"fake_outputs", required_argument, 0, 0},
285 {
"fake-outputs", required_argument, 0, 0},
286 {
"force-old-config-parser-v4.4-only", no_argument, 0, 0},
288 int option_index = 0, opt;
290 setlocale(LC_ALL,
"");
297 if (!isatty(fileno(stdout)))
298 setbuf(stdout, NULL);
311 while ((opt = getopt_long(argc, argv,
"c:CvmaL:hld:V", long_options, &option_index)) != -1) {
314 LOG(
"Autostart disabled using -a\n");
320 delete_layout_path =
false;
323 FREE(override_configpath);
324 override_configpath =
sstrdup(optarg);
327 LOG(
"Checking configuration file only (-C)\n");
331 printf(
"i3 version %s © 2009 Michael Stapelberg and contributors\n",
i3_version);
335 printf(
"Binary i3 version: %s © 2009 Michael Stapelberg and contributors\n",
i3_version);
343 LOG(
"Enabling debug logging\n");
350 if (strcmp(long_options[option_index].name,
"force-xinerama") == 0 ||
351 strcmp(long_options[option_index].name,
"force_xinerama") == 0) {
353 ELOG(
"Using Xinerama instead of RandR. This option should be " 354 "avoided at all cost because it does not refresh the list " 355 "of screens, so you cannot configure displays at runtime. " 356 "Please check if your driver really does not support RandR " 357 "and disable this option as soon as you can.\n");
359 }
else if (strcmp(long_options[option_index].name,
"disable-randr15") == 0 ||
360 strcmp(long_options[option_index].name,
"disable_randr15") == 0) {
361 disable_randr15 =
true;
363 }
else if (strcmp(long_options[option_index].name,
"disable-signalhandler") == 0) {
364 disable_signalhandler =
true;
366 }
else if (strcmp(long_options[option_index].name,
"get-socketpath") == 0 ||
367 strcmp(long_options[option_index].name,
"get_socketpath") == 0) {
370 printf(
"%s\n", socket_path);
375 }
else if (strcmp(long_options[option_index].name,
"shmlog-size") == 0 ||
376 strcmp(long_options[option_index].name,
"shmlog_size") == 0) {
383 }
else if (strcmp(long_options[option_index].name,
"restart") == 0) {
386 delete_layout_path =
true;
388 }
else if (strcmp(long_options[option_index].name,
"fake-outputs") == 0 ||
389 strcmp(long_options[option_index].name,
"fake_outputs") == 0) {
390 LOG(
"Initializing fake outputs: %s\n", optarg);
391 fake_outputs =
sstrdup(optarg);
393 }
else if (strcmp(long_options[option_index].name,
"force-old-config-parser-v4.4-only") == 0) {
394 ELOG(
"You are passing --force-old-config-parser-v4.4-only, but that flag was removed by now.\n");
399 fprintf(stderr,
"Usage: %s [-c configfile] [-d all] [-a] [-v] [-V] [-C]\n", argv[0]);
400 fprintf(stderr,
"\n");
401 fprintf(stderr,
"\t-a disable autostart ('exec' lines in config)\n");
402 fprintf(stderr,
"\t-c <file> use the provided configfile instead\n");
403 fprintf(stderr,
"\t-C validate configuration file and exit\n");
404 fprintf(stderr,
"\t-d all enable debug output\n");
405 fprintf(stderr,
"\t-L <file> path to the serialized layout during restarts\n");
406 fprintf(stderr,
"\t-v display version and exit\n");
407 fprintf(stderr,
"\t-V enable verbose mode\n");
408 fprintf(stderr,
"\n");
409 fprintf(stderr,
"\t--force-xinerama\n" 410 "\tUse Xinerama instead of RandR.\n" 411 "\tThis option should only be used if you are stuck with the\n" 412 "\told nVidia closed source driver (older than 302.17), which does\n" 413 "\tnot support RandR.\n");
414 fprintf(stderr,
"\n");
415 fprintf(stderr,
"\t--get-socketpath\n" 416 "\tRetrieve the i3 IPC socket path from X11, print it, then exit.\n");
417 fprintf(stderr,
"\n");
418 fprintf(stderr,
"\t--shmlog-size <limit>\n" 419 "\tLimits the size of the i3 SHM log to <limit> bytes. Setting this\n" 420 "\tto 0 disables SHM logging entirely.\n" 421 "\tThe default is %d bytes.\n",
423 fprintf(stderr,
"\n");
424 fprintf(stderr,
"If you pass plain text arguments, i3 will interpret them as a command\n" 425 "to send to a currently running i3 (like i3-msg). This allows you to\n" 426 "use nice and logical commands, such as:\n" 429 "\ti3 floating toggle\n" 449 LOG(
"Additional arguments passed. Sending them as a command to i3.\n");
450 char *payload = NULL;
451 while (optind < argc) {
453 payload =
sstrdup(argv[optind]);
456 sasprintf(&both,
"%s %s", payload, argv[optind]);
462 DLOG(
"Command is: %s (%zd bytes)\n", payload, strlen(payload));
465 ELOG(
"Could not get i3 IPC socket path\n");
469 int sockfd = socket(AF_LOCAL, SOCK_STREAM, 0);
471 err(EXIT_FAILURE,
"Could not create socket");
473 struct sockaddr_un addr;
474 memset(&addr, 0,
sizeof(
struct sockaddr_un));
475 addr.sun_family = AF_LOCAL;
476 strncpy(addr.sun_path, socket_path,
sizeof(addr.sun_path) - 1);
478 if (connect(sockfd, (
const struct sockaddr *)&addr,
sizeof(
struct sockaddr_un)) < 0)
479 err(EXIT_FAILURE,
"Could not connect to i3");
481 if (
ipc_send_message(sockfd, strlen(payload), I3_IPC_MESSAGE_TYPE_RUN_COMMAND,
482 (uint8_t *)payload) == -1)
483 err(EXIT_FAILURE,
"IPC: write()");
486 uint32_t reply_length;
490 if ((ret =
ipc_recv_message(sockfd, &reply_type, &reply_length, &reply)) != 0) {
492 err(EXIT_FAILURE,
"IPC: read()");
495 if (reply_type != I3_IPC_REPLY_TYPE_COMMAND)
496 errx(EXIT_FAILURE,
"IPC: received reply of type %d but expected %d (COMMAND)", reply_type, I3_IPC_REPLY_TYPE_COMMAND);
497 printf(
"%.*s\n", reply_length, reply);
507 struct rlimit limit = {RLIM_INFINITY, RLIM_INFINITY};
508 setrlimit(RLIMIT_CORE, &limit);
512 LOG(
"CORE DUMPS: You are running a development version of i3, so coredumps were automatically enabled (ulimit -c unlimited).\n");
513 size_t cwd_size = 1024;
516 while ((cwd_ret = getcwd(cwd, cwd_size)) == NULL && errno == ERANGE) {
517 cwd_size = cwd_size * 2;
521 LOG(
"CORE DUMPS: Your current working directory is \"%s\".\n", cwd);
523 if ((patternfd = open(
"/proc/sys/kernel/core_pattern", O_RDONLY)) >= 0) {
524 memset(cwd,
'\0', cwd_size);
525 if (read(patternfd, cwd, cwd_size) > 0)
527 LOG(
"CORE DUMPS: Your core_pattern is: %s", cwd);
536 if (xcb_connection_has_error(
conn))
537 errx(EXIT_FAILURE,
"Cannot open display");
546 die(
"Could not initialize libev. Bad LIBEV_FLAGS?\n");
552 #define xmacro(atom) \ 553 xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom); 554 #include "atoms.xmacro" 564 xcb_void_cookie_t cm_cookie = xcb_create_colormap_checked(
conn,
565 XCB_COLORMAP_ALLOC_NONE,
570 xcb_generic_error_t *error = xcb_request_check(
conn, cm_cookie);
572 ELOG(
"Could not create colormap. Error code: %d\n", error->error_code);
582 DLOG(
"root_screen->height_in_pixels = %d, root_screen->height_in_millimeters = %d\n",
584 DLOG(
"One logical pixel corresponds to %d physical pixels on this display.\n",
logical_px(1));
586 xcb_get_geometry_cookie_t gcookie = xcb_get_geometry(
conn,
root);
587 xcb_query_pointer_cookie_t pointercookie = xcb_query_pointer(
conn,
root);
590 #define xmacro(name) \ 592 xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(conn, name##_cookie, NULL); \ 594 ELOG("Could not get atom " #name "\n"); \ 597 A_##name = reply->atom; \ 600 #include "atoms.xmacro" 617 xcb_void_cookie_t cookie;
619 xcb_generic_error_t *error = xcb_request_check(
conn, cookie);
621 ELOG(
"Another window manager seems to be running (X error %d)\n", error->error_code);
622 #ifdef I3_ASAN_ENABLED 623 __lsan_do_leak_check();
628 xcb_get_geometry_reply_t *greply = xcb_get_geometry_reply(
conn, gcookie, NULL);
629 if (greply == NULL) {
630 ELOG(
"Could not get geometry of the root window, exiting\n");
633 DLOG(
"root geometry reply: (%d, %d) %d x %d\n", greply->x, greply->y, greply->width, greply->height);
644 const xcb_query_extension_reply_t *extreply;
645 xcb_prefetch_extension_data(
conn, &xcb_xkb_id);
646 xcb_prefetch_extension_data(
conn, &xcb_shape_id);
648 extreply = xcb_get_extension_data(
conn, &xcb_xkb_id);
650 if (!extreply->present) {
651 DLOG(
"xkb is not present on this server\n");
653 DLOG(
"initializing xcb-xkb\n");
654 xcb_xkb_use_extension(
conn, XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION);
655 xcb_xkb_select_events(
conn,
656 XCB_XKB_ID_USE_CORE_KBD,
657 XCB_XKB_EVENT_TYPE_STATE_NOTIFY | XCB_XKB_EVENT_TYPE_MAP_NOTIFY | XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY,
659 XCB_XKB_EVENT_TYPE_STATE_NOTIFY | XCB_XKB_EVENT_TYPE_MAP_NOTIFY | XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY,
674 const uint32_t mask = XCB_XKB_PER_CLIENT_FLAG_GRABS_USE_XKB_STATE |
675 XCB_XKB_PER_CLIENT_FLAG_LOOKUP_STATE_WHEN_GRABBED |
676 XCB_XKB_PER_CLIENT_FLAG_DETECTABLE_AUTO_REPEAT;
677 xcb_xkb_per_client_flags_reply_t *pcf_reply;
682 pcf_reply = xcb_xkb_per_client_flags_reply(
684 xcb_xkb_per_client_flags(
686 XCB_XKB_ID_USE_CORE_KBD,
694 #define PCF_REPLY_ERROR(_value) \ 696 if (pcf_reply == NULL || !(pcf_reply->value & (_value))) { \ 697 ELOG("Could not set " #_value "\n"); \ 711 extreply = xcb_get_extension_data(
conn, &xcb_shape_id);
712 if (extreply->present) {
714 xcb_shape_query_version_cookie_t cookie = xcb_shape_query_version(
conn);
715 xcb_shape_query_version_reply_t *version =
716 xcb_shape_query_version_reply(
conn, cookie, NULL);
723 DLOG(
"shape 1.1 is not present on this server\n");
737 die(
"Could not load keymap\n");
742 bool needs_tree_init =
true;
743 if (layout_path != NULL) {
744 LOG(
"Trying to restore the layout from \"%s\".\n", layout_path);
746 if (delete_layout_path) {
748 const char *dir = dirname(layout_path);
763 if (fake_outputs != NULL) {
773 DLOG(
"Checking for XRandR...\n");
792 if (output->
con == NULL) {
806 xcb_query_pointer_reply_t *pointerreply;
808 if (!(pointerreply = xcb_query_pointer_reply(
conn, pointercookie, NULL))) {
809 ELOG(
"Could not query pointer position, using first screen\n");
811 DLOG(
"Pointer at %d, %d\n", pointerreply->root_x, pointerreply->root_y);
814 ELOG(
"ERROR: No screen at (%d, %d), starting on the first screen\n",
815 pointerreply->root_x, pointerreply->root_y);
827 if (ipc_socket == -1) {
828 ELOG(
"Could not create the IPC socket, IPC disabled\n");
830 struct ev_io *ipc_io =
scalloc(1,
sizeof(
struct ev_io));
840 ELOG(
"socket activation: Error in sd_listen_fds\n");
842 DLOG(
"socket activation: no sockets passed\n");
848 DLOG(
"socket activation: also listening on fd %d\n", fd);
853 if ((flags = fcntl(fd, F_GETFD)) < 0 ||
854 fcntl(fd, F_SETFD, flags & ~FD_CLOEXEC) < 0) {
855 ELOG(
"Could not disable FD_CLOEXEC on fd %d\n", fd);
858 struct ev_io *ipc_io =
scalloc(1,
sizeof(
struct ev_io));
866 if (restart_fd != -1) {
867 DLOG(
"serving restart fd %d", restart_fd);
870 unsetenv(
"_I3_RESTART_FD");
881 struct ev_io *xcb_watcher =
scalloc(1,
sizeof(
struct ev_io));
905 xcb_grab_server(
conn);
908 xcb_generic_event_t *event;
909 while ((event = xcb_poll_for_event(
conn)) != NULL) {
910 if (event->response_type == 0) {
916 int type = (
event->response_type & 0x7F);
921 if (type == XCB_MAP_REQUEST)
928 xcb_ungrab_server(
conn);
931 LOG(
"This is not an in-place restart, copying root window contents to a pixmap\n");
935 xcb_pixmap_t pixmap = xcb_generate_id(
conn);
936 xcb_gcontext_t gc = xcb_generate_id(
conn);
941 XCB_GC_FUNCTION | XCB_GC_PLANE_MASK | XCB_GC_FILL_STYLE | XCB_GC_SUBWINDOW_MODE,
942 (uint32_t[]){XCB_GX_COPY, ~0, XCB_FILL_STYLE_SOLID, XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS});
945 xcb_change_window_attributes(
conn,
root->root, XCB_CW_BACK_PIXMAP, (uint32_t[]){pixmap});
947 xcb_free_gc(
conn, gc);
948 xcb_free_pixmap(
conn, pixmap);
951 #if defined(__OpenBSD__) 952 if (pledge(
"stdio rpath wpath cpath proc exec unix", NULL) == -1)
953 err(EXIT_FAILURE,
"pledge");
956 if (!disable_signalhandler)
959 struct sigaction action;
962 action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;
963 sigemptyset(&action.sa_mask);
966 if (sigaction(SIGQUIT, &action, NULL) == -1 ||
967 sigaction(SIGILL, &action, NULL) == -1 ||
968 sigaction(SIGABRT, &action, NULL) == -1 ||
969 sigaction(SIGFPE, &action, NULL) == -1 ||
970 sigaction(SIGSEGV, &action, NULL) == -1)
971 ELOG(
"Could not setup signal handler.\n");
977 signal(SIGPIPE, SIG_IGN);
997 LOG(
"auto-starting (always!) %s\n", exec_always->
command);
1011 barconfig->
verbose ?
"-V" :
"",
void main_set_x11_cb(bool enable)
Enable or disable the main X11 event handling function.
char * i3bar_command
Command that should be run to execute i3bar, give a full path if i3bar is not in your $PATH...
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...
struct outputs_head outputs
static void i3_exit(void)
void * srealloc(void *ptr, size_t size)
Safe-wrapper around realloc which exits if realloc returns NULL (meaning that there is no more memory...
bool parse_long(const char *str, long *out, int base)
Converts a string into a long using strtol().
void xcursor_load_cursors(void)
int logical_px(const int logical)
Convert a logical amount of pixels (e.g.
char * current_socketpath
void init_logging(void)
Initializes logging by creating an error logfile in /tmp (or XDG_RUNTIME_DIR, see get_process_filenam...
void scratchpad_fix_resolution(void)
When starting i3 initially (and after each change to the connected outputs), this function fixes the ...
struct barconfig_head barconfigs
char * id
Automatically generated ID for this bar config.
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...
void init_dpi(void)
Initialize the DPI setting.
void xcb_set_root_cursor(int cursor)
Set the cursor of the root window to the given cursor id.
bool event_is_ignored(const int sequence, const int response_type)
Checks if the given sequence is ignored and returns true if so.
void * smalloc(size_t size)
Safe-wrapper around malloc which exits if malloc returns NULL (meaning that there is no more memory a...
static void handle_core_signal(int sig, siginfo_t *info, void *data)
void fake_outputs_init(const char *output_spec)
Creates outputs according to the given specification.
#define TAILQ_EMPTY(head)
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...
static int parse_restart_fd(void)
xcb_connection_t * conn
XCB connection and root screen.
void start_application(const char *command, bool no_startup_id)
Starts the given application by passing it through a shell.
bool load_configuration(const char *override_configpath, config_load_t load_type)
(Re-)loads the configuration file (sets useful defaults before).
struct bindings_head * bindings
struct autostarts_always_head autostarts_always
struct assignments_head assignments
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...
const int default_shmlog_size
xcb_screen_t * root_screen
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...
char * fake_outputs
Overwrites output detection (for testing), see src/fake_outputs.c.
static void setup_term_handlers(void)
Con * con
Pointer to the Con which represents this output.
void ewmh_update_workarea(void)
i3 currently does not support _NET_WORKAREA, because it does not correspond to i3’s concept of work...
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 ipc_confirm_restart(ipc_client *client)
Sends a restart reply to the IPC client on the specified fd.
#define TAILQ_REMOVE(head, elm, field)
void grab_all_keys(xcb_connection_t *conn)
Grab the bound keys (tell X to send us keypress events for those keycodes)
bool force_xinerama
By default, use the RandR API for multi-monitor setups.
static struct ev_prepare * xcb_prepare
void output_init_con(Output *output)
Initializes a CT_OUTPUT Con (searches existing ones from inplace restart before) to use for the given...
void ewmh_setup_hints(void)
Set up the EWMH hints on the root window.
struct rlimit original_rlimit_core
The original value of RLIMIT_CORE when i3 was started.
A 'Con' represents everything from the X11 root window down to a single X11 window.
#define TAILQ_FIRST(head)
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 set_verbosity(bool _verbose)
Set verbosity of i3.
Output * get_first_output(void)
Returns the first output which is active.
xcb_visualtype_t * visual_type
bool changed
Internal flags, necessary for querying RandR screens (happens in two stages)
#define SD_LISTEN_FDS_START
void tree_render(void)
Renders the tree, that is rendering all outputs using render_con() and pushing the changes to X11 usi...
int sd_listen_fds(int unset_environment)
Holds a command specified by either an:
#define PCF_REPLY_ERROR(_value)
void display_running_version(void)
Connects to i3 to find out the currently running version.
bool disable_randr15
Don’t use RandR 1.5 for querying outputs.
void manage_existing_windows(xcb_window_t root)
Go through all existing windows (if the window manager is restarted) and manage them.
void property_handlers_init(void)
Sets the appropriate atoms for the property handlers after the atoms were received from X11...
char * sstrdup(const char *str)
Safe-wrapper around strdup which exits if malloc returns NULL (meaning that there is no more memory a...
char * get_process_filename(const char *prefix)
Returns the name of a temporary file with the specified prefix.
void setup_signal_handler(void)
Configured a signal handler to gracefully handle crashes and allow the user to generate a backtrace a...
void ipc_shutdown(shutdown_reason_t reason, int exempt_fd)
Calls shutdown() on each socket and closes it.
xcb_key_symbols_t * keysyms
bool active
Whether the output is currently active (has a CRTC attached with a valid mode)
Con * output_get_content(Con *output)
Returns the output container below the given output container.
unsigned int xcb_numlock_mask
struct reservedpx __attribute__
An Output is a physical output on your graphics driver.
void ewmh_update_desktop_properties(void)
Updates all the EWMH desktop properties.
void restore_connect(void)
Opens a separate connection to X11 for placeholder windows when restoring layouts.
bool verbose
Enable verbose mode? Useful for debugging purposes.
bool load_keymap(void)
Loads the XKB keymap from the X11 server and feeds it to xkbcommon.
void set_debug_logging(const bool _debug_logging)
Set debug logging.
int main(int argc, char *argv[])
struct autostarts_head autostarts
bool tree_restore(const char *path, xcb_get_geometry_reply_t *geometry)
Loads tree from ~/.i3/_restart.json (used for in-place restarts).
Con * con_descend_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
xcb_visualtype_t * get_visualtype(xcb_screen_t *screen)
Returns the visual type associated with the given screen.
const char * i3_version
Git commit identifier, from version.c.
static void xcb_got_event(EV_P_ struct ev_io *w, int revents)
void translate_keysyms(void)
Translates keysymbols to keycodes for all bindings which use keysyms.
void xcursor_set_root_cursor(int cursor_id)
Sets the cursor of the root window to the 'pointer' cursor.
struct ws_assignments_head ws_assignments
struct ev_loop * main_loop
void randr_disable_output(Output *output)
Disables the output and moves its content.
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 ...
void con_activate(Con *con)
Sets input focus to the given container and raises it to the top.
bool no_startup_id
no_startup_id flag for start_application().
static void handle_term_signal(struct ev_loop *loop, ev_signal *signal, int revents)
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 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...
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...
char * command
Command, like in command mode.
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...
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...
char * output_primary_name(Output *output)
Retrieves the primary name of an output.
void x_set_i3_atoms(void)
Sets up i3 specific atoms (I3_SOCKET_PATH and I3_CONFIG_PATH)
static void xcb_prepare_cb(EV_P_ ev_prepare *w, int revents)
void xinerama_init(void)
We have just established a connection to the X server and need the initial Xinerama information to se...
Holds the status bar configuration (i3bar).
#define TAILQ_HEAD_INITIALIZER(head)
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...
#define TAILQ_FOREACH(var, head, field)
int listen_fds
The number of file descriptors passed via socket activation.
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...