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> 113 xcb_generic_event_t *event;
115 while ((event = xcb_poll_for_event(
conn)) != NULL) {
116 if (event->response_type == 0) {
118 DLOG(
"Expected X11 Error received for sequence %x\n", event->sequence);
120 xcb_generic_error_t *error = (xcb_generic_error_t *)event;
121 DLOG(
"X11 Error received (probably harmless)! sequence 0x%x, error_code = %d\n",
122 error->sequence, error->error_code);
129 int type = (
event->response_type & 0x7F);
147 DLOG(
"Setting main X11 callback to enabled=%d\n", enable);
164 fprintf(stderr,
"Closing SHM log \"%s\"\n",
shmlogname);
170 xcb_disconnect(
conn);
175 #if EV_VERSION_MAJOR >= 4 179 #ifdef I3_ASAN_ENABLED 180 __lsan_do_leak_check();
206 exit(128 + signal->signum);
214 static struct ev_signal signal_watchers[6];
215 size_t num_watchers =
sizeof(signal_watchers) /
sizeof(signal_watchers[0]);
229 for (
size_t i = 0; i < num_watchers; i++) {
230 ev_signal_start(
main_loop, &signal_watchers[i]);
238 int main(
int argc,
char *argv[]) {
241 static const char *_i3_version
__attribute__((used)) = I3_VERSION;
242 char *override_configpath = NULL;
243 bool autostart =
true;
244 char *layout_path = NULL;
245 bool delete_layout_path =
false;
246 bool disable_randr15 =
false;
247 char *fake_outputs = NULL;
248 bool disable_signalhandler =
false;
250 static struct option long_options[] = {
251 {
"no-autostart", no_argument, 0,
'a'},
252 {
"config", required_argument, 0,
'c'},
253 {
"version", no_argument, 0,
'v'},
254 {
"moreversion", no_argument, 0,
'm'},
255 {
"more-version", no_argument, 0,
'm'},
256 {
"more_version", no_argument, 0,
'm'},
257 {
"help", no_argument, 0,
'h'},
258 {
"layout", required_argument, 0,
'L'},
259 {
"restart", required_argument, 0, 0},
260 {
"force-xinerama", no_argument, 0, 0},
261 {
"force_xinerama", no_argument, 0, 0},
262 {
"disable-randr15", no_argument, 0, 0},
263 {
"disable_randr15", no_argument, 0, 0},
264 {
"disable-signalhandler", no_argument, 0, 0},
265 {
"shmlog-size", required_argument, 0, 0},
266 {
"shmlog_size", required_argument, 0, 0},
267 {
"get-socketpath", no_argument, 0, 0},
268 {
"get_socketpath", no_argument, 0, 0},
269 {
"fake_outputs", required_argument, 0, 0},
270 {
"fake-outputs", required_argument, 0, 0},
271 {
"force-old-config-parser-v4.4-only", no_argument, 0, 0},
273 int option_index = 0, opt;
275 setlocale(LC_ALL,
"");
282 if (!isatty(fileno(stdout)))
283 setbuf(stdout, NULL);
296 while ((opt = getopt_long(argc, argv,
"c:CvmaL:hld:V", long_options, &option_index)) != -1) {
299 LOG(
"Autostart disabled using -a\n");
305 delete_layout_path =
false;
308 FREE(override_configpath);
309 override_configpath =
sstrdup(optarg);
312 LOG(
"Checking configuration file only (-C)\n");
316 printf(
"i3 version %s © 2009 Michael Stapelberg and contributors\n",
i3_version);
320 printf(
"Binary i3 version: %s © 2009 Michael Stapelberg and contributors\n",
i3_version);
328 LOG(
"Enabling debug logging\n");
335 if (strcmp(long_options[option_index].name,
"force-xinerama") == 0 ||
336 strcmp(long_options[option_index].name,
"force_xinerama") == 0) {
338 ELOG(
"Using Xinerama instead of RandR. This option should be " 339 "avoided at all cost because it does not refresh the list " 340 "of screens, so you cannot configure displays at runtime. " 341 "Please check if your driver really does not support RandR " 342 "and disable this option as soon as you can.\n");
344 }
else if (strcmp(long_options[option_index].name,
"disable-randr15") == 0 ||
345 strcmp(long_options[option_index].name,
"disable_randr15") == 0) {
346 disable_randr15 =
true;
348 }
else if (strcmp(long_options[option_index].name,
"disable-signalhandler") == 0) {
349 disable_signalhandler =
true;
351 }
else if (strcmp(long_options[option_index].name,
"get-socketpath") == 0 ||
352 strcmp(long_options[option_index].name,
"get_socketpath") == 0) {
355 printf(
"%s\n", socket_path);
360 }
else if (strcmp(long_options[option_index].name,
"shmlog-size") == 0 ||
361 strcmp(long_options[option_index].name,
"shmlog_size") == 0) {
368 }
else if (strcmp(long_options[option_index].name,
"restart") == 0) {
371 delete_layout_path =
true;
373 }
else if (strcmp(long_options[option_index].name,
"fake-outputs") == 0 ||
374 strcmp(long_options[option_index].name,
"fake_outputs") == 0) {
375 LOG(
"Initializing fake outputs: %s\n", optarg);
376 fake_outputs =
sstrdup(optarg);
378 }
else if (strcmp(long_options[option_index].name,
"force-old-config-parser-v4.4-only") == 0) {
379 ELOG(
"You are passing --force-old-config-parser-v4.4-only, but that flag was removed by now.\n");
384 fprintf(stderr,
"Usage: %s [-c configfile] [-d all] [-a] [-v] [-V] [-C]\n", argv[0]);
385 fprintf(stderr,
"\n");
386 fprintf(stderr,
"\t-a disable autostart ('exec' lines in config)\n");
387 fprintf(stderr,
"\t-c <file> use the provided configfile instead\n");
388 fprintf(stderr,
"\t-C validate configuration file and exit\n");
389 fprintf(stderr,
"\t-d all enable debug output\n");
390 fprintf(stderr,
"\t-L <file> path to the serialized layout during restarts\n");
391 fprintf(stderr,
"\t-v display version and exit\n");
392 fprintf(stderr,
"\t-V enable verbose mode\n");
393 fprintf(stderr,
"\n");
394 fprintf(stderr,
"\t--force-xinerama\n" 395 "\tUse Xinerama instead of RandR.\n" 396 "\tThis option should only be used if you are stuck with the\n" 397 "\told nVidia closed source driver (older than 302.17), which does\n" 398 "\tnot support RandR.\n");
399 fprintf(stderr,
"\n");
400 fprintf(stderr,
"\t--get-socketpath\n" 401 "\tRetrieve the i3 IPC socket path from X11, print it, then exit.\n");
402 fprintf(stderr,
"\n");
403 fprintf(stderr,
"\t--shmlog-size <limit>\n" 404 "\tLimits the size of the i3 SHM log to <limit> bytes. Setting this\n" 405 "\tto 0 disables SHM logging entirely.\n" 406 "\tThe default is %d bytes.\n",
408 fprintf(stderr,
"\n");
409 fprintf(stderr,
"If you pass plain text arguments, i3 will interpret them as a command\n" 410 "to send to a currently running i3 (like i3-msg). This allows you to\n" 411 "use nice and logical commands, such as:\n" 414 "\ti3 floating toggle\n" 434 LOG(
"Additional arguments passed. Sending them as a command to i3.\n");
435 char *payload = NULL;
436 while (optind < argc) {
438 payload =
sstrdup(argv[optind]);
441 sasprintf(&both,
"%s %s", payload, argv[optind]);
447 DLOG(
"Command is: %s (%zd bytes)\n", payload, strlen(payload));
450 ELOG(
"Could not get i3 IPC socket path\n");
454 int sockfd = socket(AF_LOCAL, SOCK_STREAM, 0);
456 err(EXIT_FAILURE,
"Could not create socket");
458 struct sockaddr_un addr;
459 memset(&addr, 0,
sizeof(
struct sockaddr_un));
460 addr.sun_family = AF_LOCAL;
461 strncpy(addr.sun_path, socket_path,
sizeof(addr.sun_path) - 1);
463 if (connect(sockfd, (
const struct sockaddr *)&addr,
sizeof(
struct sockaddr_un)) < 0)
464 err(EXIT_FAILURE,
"Could not connect to i3");
466 if (
ipc_send_message(sockfd, strlen(payload), I3_IPC_MESSAGE_TYPE_RUN_COMMAND,
467 (uint8_t *)payload) == -1)
468 err(EXIT_FAILURE,
"IPC: write()");
471 uint32_t reply_length;
475 if ((ret =
ipc_recv_message(sockfd, &reply_type, &reply_length, &reply)) != 0) {
477 err(EXIT_FAILURE,
"IPC: read()");
480 if (reply_type != I3_IPC_REPLY_TYPE_COMMAND)
481 errx(EXIT_FAILURE,
"IPC: received reply of type %d but expected %d (COMMAND)", reply_type, I3_IPC_REPLY_TYPE_COMMAND);
482 printf(
"%.*s\n", reply_length, reply);
492 struct rlimit limit = {RLIM_INFINITY, RLIM_INFINITY};
493 setrlimit(RLIMIT_CORE, &limit);
497 LOG(
"CORE DUMPS: You are running a development version of i3, so coredumps were automatically enabled (ulimit -c unlimited).\n");
498 size_t cwd_size = 1024;
501 while ((cwd_ret = getcwd(cwd, cwd_size)) == NULL && errno == ERANGE) {
502 cwd_size = cwd_size * 2;
506 LOG(
"CORE DUMPS: Your current working directory is \"%s\".\n", cwd);
508 if ((patternfd = open(
"/proc/sys/kernel/core_pattern", O_RDONLY)) >= 0) {
509 memset(cwd,
'\0', cwd_size);
510 if (read(patternfd, cwd, cwd_size) > 0)
512 LOG(
"CORE DUMPS: Your core_pattern is: %s", cwd);
521 if (xcb_connection_has_error(
conn))
522 errx(EXIT_FAILURE,
"Cannot open display\n");
531 die(
"Could not initialize libev. Bad LIBEV_FLAGS?\n");
537 #define xmacro(atom) \ 538 xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom); 539 #include "atoms.xmacro" 549 xcb_void_cookie_t cm_cookie = xcb_create_colormap_checked(
conn,
550 XCB_COLORMAP_ALLOC_NONE,
555 xcb_generic_error_t *error = xcb_request_check(
conn, cm_cookie);
557 ELOG(
"Could not create colormap. Error code: %d\n", error->error_code);
567 DLOG(
"root_screen->height_in_pixels = %d, root_screen->height_in_millimeters = %d\n",
569 DLOG(
"One logical pixel corresponds to %d physical pixels on this display.\n",
logical_px(1));
571 xcb_get_geometry_cookie_t gcookie = xcb_get_geometry(
conn,
root);
572 xcb_query_pointer_cookie_t pointercookie = xcb_query_pointer(
conn,
root);
575 #define xmacro(name) \ 577 xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(conn, name##_cookie, NULL); \ 579 ELOG("Could not get atom " #name "\n"); \ 582 A_##name = reply->atom; \ 585 #include "atoms.xmacro" 602 xcb_void_cookie_t cookie;
604 xcb_generic_error_t *error = xcb_request_check(
conn, cookie);
606 ELOG(
"Another window manager seems to be running (X error %d)\n", error->error_code);
607 #ifdef I3_ASAN_ENABLED 608 __lsan_do_leak_check();
613 xcb_get_geometry_reply_t *greply = xcb_get_geometry_reply(
conn, gcookie, NULL);
614 if (greply == NULL) {
615 ELOG(
"Could not get geometry of the root window, exiting\n");
618 DLOG(
"root geometry reply: (%d, %d) %d x %d\n", greply->x, greply->y, greply->width, greply->height);
629 const xcb_query_extension_reply_t *extreply;
630 extreply = xcb_get_extension_data(
conn, &xcb_xkb_id);
632 if (!extreply->present) {
633 DLOG(
"xkb is not present on this server\n");
635 DLOG(
"initializing xcb-xkb\n");
636 xcb_xkb_use_extension(
conn, XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION);
637 xcb_xkb_select_events(
conn,
638 XCB_XKB_ID_USE_CORE_KBD,
639 XCB_XKB_EVENT_TYPE_STATE_NOTIFY | XCB_XKB_EVENT_TYPE_MAP_NOTIFY | XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY,
641 XCB_XKB_EVENT_TYPE_STATE_NOTIFY | XCB_XKB_EVENT_TYPE_MAP_NOTIFY | XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY,
656 const uint32_t mask = XCB_XKB_PER_CLIENT_FLAG_GRABS_USE_XKB_STATE |
657 XCB_XKB_PER_CLIENT_FLAG_LOOKUP_STATE_WHEN_GRABBED |
658 XCB_XKB_PER_CLIENT_FLAG_DETECTABLE_AUTO_REPEAT;
659 xcb_xkb_per_client_flags_reply_t *pcf_reply;
664 pcf_reply = xcb_xkb_per_client_flags_reply(
666 xcb_xkb_per_client_flags(
668 XCB_XKB_ID_USE_CORE_KBD,
676 #define PCF_REPLY_ERROR(_value) \ 678 if (pcf_reply == NULL || !(pcf_reply->value & (_value))) { \ 679 ELOG("Could not set " #_value "\n"); \ 702 die(
"Could not load keymap\n");
707 bool needs_tree_init =
true;
708 if (layout_path != NULL) {
709 LOG(
"Trying to restore the layout from \"%s\".\n", layout_path);
711 if (delete_layout_path) {
713 const char *dir = dirname(layout_path);
728 if (fake_outputs != NULL) {
738 DLOG(
"Checking for XRandR...\n");
757 if (output->
con == NULL) {
771 xcb_query_pointer_reply_t *pointerreply;
773 if (!(pointerreply = xcb_query_pointer_reply(
conn, pointercookie, NULL))) {
774 ELOG(
"Could not query pointer position, using first screen\n");
776 DLOG(
"Pointer at %d, %d\n", pointerreply->root_x, pointerreply->root_y);
779 ELOG(
"ERROR: No screen at (%d, %d), starting on the first screen\n",
780 pointerreply->root_x, pointerreply->root_y);
792 if (ipc_socket == -1) {
793 ELOG(
"Could not create the IPC socket, IPC disabled\n");
795 struct ev_io *ipc_io =
scalloc(1,
sizeof(
struct ev_io));
805 ELOG(
"socket activation: Error in sd_listen_fds\n");
807 DLOG(
"socket activation: no sockets passed\n");
813 DLOG(
"socket activation: also listening on fd %d\n", fd);
818 if ((flags = fcntl(fd, F_GETFD)) < 0 ||
819 fcntl(fd, F_SETFD, flags & ~FD_CLOEXEC) < 0) {
820 ELOG(
"Could not disable FD_CLOEXEC on fd %d\n", fd);
823 struct ev_io *ipc_io =
scalloc(1,
sizeof(
struct ev_io));
839 struct ev_io *xcb_watcher =
scalloc(1,
sizeof(
struct ev_io));
863 xcb_grab_server(
conn);
866 xcb_generic_event_t *event;
867 while ((event = xcb_poll_for_event(
conn)) != NULL) {
868 if (event->response_type == 0) {
874 int type = (
event->response_type & 0x7F);
879 if (type == XCB_MAP_REQUEST)
886 xcb_ungrab_server(
conn);
889 LOG(
"This is not an in-place restart, copying root window contents to a pixmap\n");
893 xcb_pixmap_t pixmap = xcb_generate_id(
conn);
894 xcb_gcontext_t gc = xcb_generate_id(
conn);
899 XCB_GC_FUNCTION | XCB_GC_PLANE_MASK | XCB_GC_FILL_STYLE | XCB_GC_SUBWINDOW_MODE,
900 (uint32_t[]){XCB_GX_COPY, ~0, XCB_FILL_STYLE_SOLID, XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS});
903 xcb_change_window_attributes(
conn,
root->root, XCB_CW_BACK_PIXMAP, (uint32_t[]){pixmap});
905 xcb_free_gc(
conn, gc);
906 xcb_free_pixmap(
conn, pixmap);
909 #if defined(__OpenBSD__) 910 if (pledge(
"stdio rpath wpath cpath proc exec unix", NULL) == -1)
911 err(EXIT_FAILURE,
"pledge");
914 if (!disable_signalhandler)
917 struct sigaction action;
920 action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;
921 sigemptyset(&action.sa_mask);
924 if (sigaction(SIGQUIT, &action, NULL) == -1 ||
925 sigaction(SIGILL, &action, NULL) == -1 ||
926 sigaction(SIGABRT, &action, NULL) == -1 ||
927 sigaction(SIGFPE, &action, NULL) == -1 ||
928 sigaction(SIGSEGV, &action, NULL) == -1)
929 ELOG(
"Could not setup signal handler.\n");
935 signal(SIGPIPE, SIG_IGN);
955 LOG(
"auto-starting (always!) %s\n", exec_always->
command);
969 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...
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...
bool no_startup_id
no_startup_id flag for start_application().
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
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...
xcb_connection_t * conn
XCB connection and root screen.
An Output is a physical output on your graphics driver.
void start_application(const char *command, bool no_startup_id)
Starts the given application by passing it through a shell.
struct bindings_head * bindings
void ewmh_update_number_of_desktops(void)
Updates _NET_NUMBER_OF_DESKTOPS which we interpret as the number of noninternal workspaces.
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...
static void setup_term_handlers(void)
void ewmh_update_current_desktop(void)
Updates _NET_CURRENT_DESKTOP with the current desktop number.
bool verbose
Enable verbose mode? Useful for debugging purposes.
bool changed
Internal flags, necessary for querying RandR screens (happens in two stages)
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),...
#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)
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.
void ewmh_update_desktop_viewport(void)
Updates _NET_DESKTOP_VIEWPORT, which is an array of pairs of cardinals that define the top left corne...
char * command
Command, like in command mode.
#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.
Con * con
Pointer to the Con which represents this output.
xcb_visualtype_t * visual_type
#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)
bool active
Whether the output is currently active (has a CRTC attached with a valid mode)
char * fake_outputs
Overwrites output detection (for testing), see src/fake_outputs.c.
#define PCF_REPLY_ERROR(_value)
void display_running_version(void)
Connects to i3 to find out the currently running version.
void manage_existing_windows(xcb_window_t root)
Go through all existing windows (if the window manager is restarted) and manage them.
void ewmh_update_desktop_names(void)
Updates _NET_DESKTOP_NAMES: "The names of all virtual desktops.
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...
bool force_xinerama
By default, use the RandR API for multi-monitor setups.
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 load_configuration(xcb_connection_t *conn, const char *override_configpath, bool reload)
Reads the configuration from ~/.i3/config or /etc/i3/config if not found.
xcb_key_symbols_t * keysyms
Con * output_get_content(Con *output)
Returns the output container below the given output container.
unsigned int xcb_numlock_mask
struct reservedpx __attribute__
void ipc_shutdown(shutdown_reason_t reason)
Calls shutdown() on each socket and closes it.
void restore_connect(void)
Opens a separate connection to X11 for placeholder windows when restoring layouts.
Holds a command specified by either an:
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.
Holds the status bar configuration (i3bar).
A 'Con' represents everything from the X11 root window down to a single X11 window.
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
bool disable_randr15
Don’t use RandR 1.5 for querying outputs.
struct ev_loop * main_loop
bool parse_configuration(const char *override_configpath, bool use_nagbar)
Finds the configuration file to use (either the one specified by override_configpath),...
void randr_disable_output(Output *output)
Disables the output and moves its content.
void con_activate(Con *con)
Sets input focus to the given container and raises it to the top.
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...
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...
#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.
char * id
Automatically generated ID for this bar config.