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> 115 xcb_generic_event_t *event;
117 while ((event = xcb_poll_for_event(
conn)) != NULL) {
118 if (event->response_type == 0) {
120 DLOG(
"Expected X11 Error received for sequence %x\n", event->sequence);
122 xcb_generic_error_t *error = (xcb_generic_error_t *)event;
123 DLOG(
"X11 Error received (probably harmless)! sequence 0x%x, error_code = %d\n",
124 error->sequence, error->error_code);
131 int type = (
event->response_type & 0x7F);
149 DLOG(
"Setting main X11 callback to enabled=%d\n", enable);
168 #if EV_VERSION_MAJOR >= 4 173 fprintf(stderr,
"Closing SHM log \"%s\"\n",
shmlogname);
203 exit(128 + signal->signum);
211 static struct ev_signal signal_watchers[6];
212 size_t num_watchers =
sizeof(signal_watchers) /
sizeof(signal_watchers[0]);
226 for (
size_t i = 0; i < num_watchers; i++) {
227 ev_signal_start(
main_loop, &signal_watchers[i]);
235 int main(
int argc,
char *argv[]) {
238 static const char *_i3_version
__attribute__((used)) = I3_VERSION;
239 char *override_configpath = NULL;
240 bool autostart =
true;
241 char *layout_path = NULL;
242 bool delete_layout_path =
false;
243 bool disable_randr15 =
false;
244 char *fake_outputs = NULL;
245 bool disable_signalhandler =
false;
247 static struct option long_options[] = {
248 {
"no-autostart", no_argument, 0,
'a'},
249 {
"config", required_argument, 0,
'c'},
250 {
"version", no_argument, 0,
'v'},
251 {
"moreversion", no_argument, 0,
'm'},
252 {
"more-version", no_argument, 0,
'm'},
253 {
"more_version", no_argument, 0,
'm'},
254 {
"help", no_argument, 0,
'h'},
255 {
"layout", required_argument, 0,
'L'},
256 {
"restart", required_argument, 0, 0},
257 {
"force-xinerama", no_argument, 0, 0},
258 {
"force_xinerama", no_argument, 0, 0},
259 {
"disable-randr15", no_argument, 0, 0},
260 {
"disable_randr15", no_argument, 0, 0},
261 {
"disable-signalhandler", no_argument, 0, 0},
262 {
"shmlog-size", required_argument, 0, 0},
263 {
"shmlog_size", required_argument, 0, 0},
264 {
"get-socketpath", no_argument, 0, 0},
265 {
"get_socketpath", no_argument, 0, 0},
266 {
"fake_outputs", required_argument, 0, 0},
267 {
"fake-outputs", required_argument, 0, 0},
268 {
"force-old-config-parser-v4.4-only", no_argument, 0, 0},
270 int option_index = 0, opt;
272 setlocale(LC_ALL,
"");
279 if (!isatty(fileno(stdout)))
280 setbuf(stdout, NULL);
293 while ((opt = getopt_long(argc, argv,
"c:CvmaL:hld:V", long_options, &option_index)) != -1) {
296 LOG(
"Autostart disabled using -a\n");
302 delete_layout_path =
false;
305 FREE(override_configpath);
306 override_configpath =
sstrdup(optarg);
309 LOG(
"Checking configuration file only (-C)\n");
310 only_check_config =
true;
313 printf(
"i3 version %s © 2009 Michael Stapelberg and contributors\n",
i3_version);
317 printf(
"Binary i3 version: %s © 2009 Michael Stapelberg and contributors\n",
i3_version);
325 LOG(
"Enabling debug logging\n");
332 if (strcmp(long_options[option_index].name,
"force-xinerama") == 0 ||
333 strcmp(long_options[option_index].name,
"force_xinerama") == 0) {
335 ELOG(
"Using Xinerama instead of RandR. This option should be " 336 "avoided at all cost because it does not refresh the list " 337 "of screens, so you cannot configure displays at runtime. " 338 "Please check if your driver really does not support RandR " 339 "and disable this option as soon as you can.\n");
341 }
else if (strcmp(long_options[option_index].name,
"disable-randr15") == 0 ||
342 strcmp(long_options[option_index].name,
"disable_randr15") == 0) {
343 disable_randr15 =
true;
345 }
else if (strcmp(long_options[option_index].name,
"disable-signalhandler") == 0) {
346 disable_signalhandler =
true;
348 }
else if (strcmp(long_options[option_index].name,
"get-socketpath") == 0 ||
349 strcmp(long_options[option_index].name,
"get_socketpath") == 0) {
352 printf(
"%s\n", socket_path);
357 }
else if (strcmp(long_options[option_index].name,
"shmlog-size") == 0 ||
358 strcmp(long_options[option_index].name,
"shmlog_size") == 0) {
365 }
else if (strcmp(long_options[option_index].name,
"restart") == 0) {
368 delete_layout_path =
true;
370 }
else if (strcmp(long_options[option_index].name,
"fake-outputs") == 0 ||
371 strcmp(long_options[option_index].name,
"fake_outputs") == 0) {
372 LOG(
"Initializing fake outputs: %s\n", optarg);
373 fake_outputs =
sstrdup(optarg);
375 }
else if (strcmp(long_options[option_index].name,
"force-old-config-parser-v4.4-only") == 0) {
376 ELOG(
"You are passing --force-old-config-parser-v4.4-only, but that flag was removed by now.\n");
381 fprintf(stderr,
"Usage: %s [-c configfile] [-d all] [-a] [-v] [-V] [-C]\n", argv[0]);
382 fprintf(stderr,
"\n");
383 fprintf(stderr,
"\t-a disable autostart ('exec' lines in config)\n");
384 fprintf(stderr,
"\t-c <file> use the provided configfile instead\n");
385 fprintf(stderr,
"\t-C validate configuration file and exit\n");
386 fprintf(stderr,
"\t-d all enable debug output\n");
387 fprintf(stderr,
"\t-L <file> path to the serialized layout during restarts\n");
388 fprintf(stderr,
"\t-v display version and exit\n");
389 fprintf(stderr,
"\t-V enable verbose mode\n");
390 fprintf(stderr,
"\n");
391 fprintf(stderr,
"\t--force-xinerama\n" 392 "\tUse Xinerama instead of RandR.\n" 393 "\tThis option should only be used if you are stuck with the\n" 394 "\told nVidia closed source driver (older than 302.17), which does\n" 395 "\tnot support RandR.\n");
396 fprintf(stderr,
"\n");
397 fprintf(stderr,
"\t--get-socketpath\n" 398 "\tRetrieve the i3 IPC socket path from X11, print it, then exit.\n");
399 fprintf(stderr,
"\n");
400 fprintf(stderr,
"\t--shmlog-size <limit>\n" 401 "\tLimits the size of the i3 SHM log to <limit> bytes. Setting this\n" 402 "\tto 0 disables SHM logging entirely.\n" 403 "\tThe default is %d bytes.\n",
405 fprintf(stderr,
"\n");
406 fprintf(stderr,
"If you pass plain text arguments, i3 will interpret them as a command\n" 407 "to send to a currently running i3 (like i3-msg). This allows you to\n" 408 "use nice and logical commands, such as:\n" 411 "\ti3 floating toggle\n" 418 if (only_check_config) {
431 LOG(
"Additional arguments passed. Sending them as a command to i3.\n");
432 char *payload = NULL;
433 while (optind < argc) {
435 payload =
sstrdup(argv[optind]);
438 sasprintf(&both,
"%s %s", payload, argv[optind]);
444 DLOG(
"Command is: %s (%zd bytes)\n", payload, strlen(payload));
447 ELOG(
"Could not get i3 IPC socket path\n");
451 int sockfd = socket(AF_LOCAL, SOCK_STREAM, 0);
453 err(EXIT_FAILURE,
"Could not create socket");
455 struct sockaddr_un addr;
456 memset(&addr, 0,
sizeof(
struct sockaddr_un));
457 addr.sun_family = AF_LOCAL;
458 strncpy(addr.sun_path, socket_path,
sizeof(addr.sun_path) - 1);
460 if (connect(sockfd, (
const struct sockaddr *)&addr,
sizeof(
struct sockaddr_un)) < 0)
461 err(EXIT_FAILURE,
"Could not connect to i3");
463 if (
ipc_send_message(sockfd, strlen(payload), I3_IPC_MESSAGE_TYPE_RUN_COMMAND,
464 (uint8_t *)payload) == -1)
465 err(EXIT_FAILURE,
"IPC: write()");
468 uint32_t reply_length;
472 if ((ret =
ipc_recv_message(sockfd, &reply_type, &reply_length, &reply)) != 0) {
474 err(EXIT_FAILURE,
"IPC: read()");
477 if (reply_type != I3_IPC_REPLY_TYPE_COMMAND)
478 errx(EXIT_FAILURE,
"IPC: received reply of type %d but expected %d (COMMAND)", reply_type, I3_IPC_REPLY_TYPE_COMMAND);
479 printf(
"%.*s\n", reply_length, reply);
489 struct rlimit limit = {RLIM_INFINITY, RLIM_INFINITY};
490 setrlimit(RLIMIT_CORE, &limit);
494 LOG(
"CORE DUMPS: You are running a development version of i3, so coredumps were automatically enabled (ulimit -c unlimited).\n");
495 size_t cwd_size = 1024;
498 while ((cwd_ret = getcwd(cwd, cwd_size)) == NULL && errno == ERANGE) {
499 cwd_size = cwd_size * 2;
503 LOG(
"CORE DUMPS: Your current working directory is \"%s\".\n", cwd);
505 if ((patternfd = open(
"/proc/sys/kernel/core_pattern", O_RDONLY)) >= 0) {
506 memset(cwd,
'\0', cwd_size);
507 if (read(patternfd, cwd, cwd_size) > 0)
509 LOG(
"CORE DUMPS: Your core_pattern is: %s", cwd);
518 if (xcb_connection_has_error(
conn))
519 errx(EXIT_FAILURE,
"Cannot open display\n");
528 die(
"Could not initialize libev. Bad LIBEV_FLAGS?\n");
534 #define xmacro(atom) \ 535 xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom); 536 #include "atoms.xmacro" 546 xcb_void_cookie_t cm_cookie = xcb_create_colormap_checked(
conn,
547 XCB_COLORMAP_ALLOC_NONE,
552 xcb_generic_error_t *error = xcb_request_check(
conn, cm_cookie);
554 ELOG(
"Could not create colormap. Error code: %d\n", error->error_code);
564 DLOG(
"root_screen->height_in_pixels = %d, root_screen->height_in_millimeters = %d\n",
566 DLOG(
"One logical pixel corresponds to %d physical pixels on this display.\n",
logical_px(1));
568 xcb_get_geometry_cookie_t gcookie = xcb_get_geometry(
conn,
root);
569 xcb_query_pointer_cookie_t pointercookie = xcb_query_pointer(
conn,
root);
572 #define xmacro(name) \ 574 xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(conn, name##_cookie, NULL); \ 576 ELOG("Could not get atom " #name "\n"); \ 579 A_##name = reply->atom; \ 582 #include "atoms.xmacro" 599 xcb_void_cookie_t cookie;
601 xcb_generic_error_t *error = xcb_request_check(
conn, cookie);
603 ELOG(
"Another window manager seems to be running (X error %d)\n", error->error_code);
604 #ifdef I3_ASAN_ENABLED 605 __lsan_do_leak_check();
610 xcb_get_geometry_reply_t *greply = xcb_get_geometry_reply(
conn, gcookie, NULL);
611 if (greply == NULL) {
612 ELOG(
"Could not get geometry of the root window, exiting\n");
615 DLOG(
"root geometry reply: (%d, %d) %d x %d\n", greply->x, greply->y, greply->width, greply->height);
626 const xcb_query_extension_reply_t *extreply;
627 extreply = xcb_get_extension_data(
conn, &xcb_xkb_id);
629 if (!extreply->present) {
630 DLOG(
"xkb is not present on this server\n");
632 DLOG(
"initializing xcb-xkb\n");
633 xcb_xkb_use_extension(
conn, XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION);
634 xcb_xkb_select_events(
conn,
635 XCB_XKB_ID_USE_CORE_KBD,
636 XCB_XKB_EVENT_TYPE_STATE_NOTIFY | XCB_XKB_EVENT_TYPE_MAP_NOTIFY | XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY,
638 XCB_XKB_EVENT_TYPE_STATE_NOTIFY | XCB_XKB_EVENT_TYPE_MAP_NOTIFY | XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY,
648 xcb_xkb_per_client_flags_reply_t *pcf_reply;
653 pcf_reply = xcb_xkb_per_client_flags_reply(
655 xcb_xkb_per_client_flags(
657 XCB_XKB_ID_USE_CORE_KBD,
658 XCB_XKB_PER_CLIENT_FLAG_GRABS_USE_XKB_STATE | XCB_XKB_PER_CLIENT_FLAG_LOOKUP_STATE_WHEN_GRABBED,
659 XCB_XKB_PER_CLIENT_FLAG_GRABS_USE_XKB_STATE | XCB_XKB_PER_CLIENT_FLAG_LOOKUP_STATE_WHEN_GRABBED,
664 if (pcf_reply == NULL ||
665 !(pcf_reply->value & XCB_XKB_PER_CLIENT_FLAG_GRABS_USE_XKB_STATE)) {
666 ELOG(
"Could not set XCB_XKB_PER_CLIENT_FLAG_GRABS_USE_XKB_STATE\n");
668 if (pcf_reply == NULL ||
669 !(pcf_reply->value & XCB_XKB_PER_CLIENT_FLAG_LOOKUP_STATE_WHEN_GRABBED)) {
670 ELOG(
"Could not set XCB_XKB_PER_CLIENT_FLAG_LOOKUP_STATE_WHEN_GRABBED\n");
687 die(
"Could not load keymap\n");
692 bool needs_tree_init =
true;
693 if (layout_path != NULL) {
694 LOG(
"Trying to restore the layout from \"%s\".\n", layout_path);
696 if (delete_layout_path) {
698 const char *dir = dirname(layout_path);
713 if (fake_outputs != NULL) {
723 DLOG(
"Checking for XRandR...\n");
742 if (output->
con == NULL) {
756 xcb_query_pointer_reply_t *pointerreply;
758 if (!(pointerreply = xcb_query_pointer_reply(
conn, pointercookie, NULL))) {
759 ELOG(
"Could not query pointer position, using first screen\n");
761 DLOG(
"Pointer at %d, %d\n", pointerreply->root_x, pointerreply->root_y);
764 ELOG(
"ERROR: No screen at (%d, %d), starting on the first screen\n",
765 pointerreply->root_x, pointerreply->root_y);
777 if (ipc_socket == -1) {
778 ELOG(
"Could not create the IPC socket, IPC disabled\n");
780 struct ev_io *ipc_io =
scalloc(1,
sizeof(
struct ev_io));
790 ELOG(
"socket activation: Error in sd_listen_fds\n");
792 DLOG(
"socket activation: no sockets passed\n");
798 DLOG(
"socket activation: also listening on fd %d\n", fd);
803 if ((flags = fcntl(fd, F_GETFD)) < 0 ||
804 fcntl(fd, F_SETFD, flags & ~FD_CLOEXEC) < 0) {
805 ELOG(
"Could not disable FD_CLOEXEC on fd %d\n", fd);
808 struct ev_io *ipc_io =
scalloc(1,
sizeof(
struct ev_io));
824 struct ev_io *xcb_watcher =
scalloc(1,
sizeof(
struct ev_io));
848 xcb_grab_server(
conn);
851 xcb_generic_event_t *event;
852 while ((event = xcb_poll_for_event(
conn)) != NULL) {
853 if (event->response_type == 0) {
859 int type = (
event->response_type & 0x7F);
864 if (type == XCB_MAP_REQUEST)
871 xcb_ungrab_server(
conn);
874 LOG(
"This is not an in-place restart, copying root window contents to a pixmap\n");
876 uint16_t
width = root->width_in_pixels;
877 uint16_t
height = root->height_in_pixels;
878 xcb_pixmap_t pixmap = xcb_generate_id(
conn);
879 xcb_gcontext_t gc = xcb_generate_id(
conn);
881 xcb_create_pixmap(
conn, root->root_depth, pixmap, root->root, width, height);
883 xcb_create_gc(
conn, gc, root->root,
884 XCB_GC_FUNCTION | XCB_GC_PLANE_MASK | XCB_GC_FILL_STYLE | XCB_GC_SUBWINDOW_MODE,
885 (uint32_t[]){XCB_GX_COPY, ~0, XCB_FILL_STYLE_SOLID, XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS});
887 xcb_copy_area(
conn, root->root, pixmap, gc, 0, 0, 0, 0, width, height);
888 xcb_change_window_attributes(
conn, root->root, XCB_CW_BACK_PIXMAP, (uint32_t[]){pixmap});
890 xcb_free_gc(
conn, gc);
891 xcb_free_pixmap(
conn, pixmap);
894 #if defined(__OpenBSD__) 895 if (pledge(
"stdio rpath wpath cpath proc exec unix", NULL) == -1)
896 err(EXIT_FAILURE,
"pledge");
899 if (!disable_signalhandler)
902 struct sigaction action;
905 action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;
906 sigemptyset(&action.sa_mask);
909 if (sigaction(SIGQUIT, &action, NULL) == -1 ||
910 sigaction(SIGILL, &action, NULL) == -1 ||
911 sigaction(SIGABRT, &action, NULL) == -1 ||
912 sigaction(SIGFPE, &action, NULL) == -1 ||
913 sigaction(SIGSEGV, &action, NULL) == -1)
914 ELOG(
"Could not setup signal handler.\n");
920 signal(SIGPIPE, SIG_IGN);
940 LOG(
"auto-starting (always!) %s\n", exec_always->
command);
952 sasprintf(&command,
"%s --bar_id=%s --socket=\"%s\"",
955 LOG(
"Starting bar process: %s\n", command);
void main_set_x11_cb(bool enable)
Enable or disable the main X11 event handling function.
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...
struct outputs_head outputs
static void i3_exit(void)
#define TAILQ_HEAD_INITIALIZER(head)
Holds a command specified by either an:
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
void xcursor_load_cursors(void)
char * sstrdup(const char *str)
Safe-wrapper around strdup which exits if malloc returns NULL (meaning that there is no more memory a...
#define TAILQ_EMPTY(head)
char * get_process_filename(const char *prefix)
Returns the name of a temporary file with the specified prefix.
Holds the status bar configuration (i3bar).
A 'Con' represents everything from the X11 root window down to a single X11 window.
bool event_is_ignored(const int sequence, const int response_type)
Checks if the given sequence is ignored and returns true if so.
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.
xcb_connection_t * conn
XCB connection and root screen.
void xinerama_init(void)
We have just established a connection to the X server and need the initial Xinerama information to se...
void start_application(const char *command, bool no_startup_id)
Starts the given application by passing it through a shell.
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...
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
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...
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)
#define SD_LISTEN_FDS_START
xcb_visualtype_t * get_visualtype(xcb_screen_t *screen)
Returns the visual type associated with the given screen.
static void setup_term_handlers(void)
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...
void ewmh_update_current_desktop(void)
Updates _NET_CURRENT_DESKTOP with the current desktop number.
char * i3bar_command
Command that should be run to execute i3bar, give a full path if i3bar is not in your $PATH...
void ewmh_update_workarea(void)
i3 currently does not support _NET_WORKAREA, because it does not correspond to i3’s concept of works...
void xcb_set_root_cursor(int cursor)
Set the cursor of the root window to the given cursor id.
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.
bool force_xinerama
By default, use the RandR API for multi-monitor setups.
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...
void set_verbosity(bool _verbose)
Set verbosity of i3.
Output * get_first_output(void)
Returns the first output which is active.
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...
#define TAILQ_FOREACH(var, head, field)
xcb_visualtype_t * visual_type
struct reservedpx __attribute__
#define TAILQ_FIRST(head)
void xcursor_set_root_cursor(int cursor_id)
Sets the cursor of the root window to the 'pointer' cursor.
int sd_listen_fds(int unset_environment)
bool tree_restore(const char *path, xcb_get_geometry_reply_t *geometry)
Loads tree from ~/.i3/_restart.json (used for in-place restarts).
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.
#define TAILQ_REMOVE(head, elm, field)
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...
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
void * smalloc(size_t size)
Safe-wrapper around malloc which exits if malloc returns NULL (meaning that there is no more memory a...
Con * output_get_content(Con *output)
Returns the output container below the given output container.
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...
void ipc_shutdown(shutdown_reason_t reason)
Calls shutdown() on each socket and closes it.
char * id
Automatically generated ID for this bar config.
void restore_connect(void)
Opens a separate connection to X11 for placeholder windows when restoring layouts.
bool load_keymap(void)
Loads the XKB keymap from the X11 server and feeds it to xkbcommon.
An Output is a physical output on your graphics driver.
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 set_debug_logging(const bool _debug_logging)
Set debug logging.
bool is_debug_build() __attribute__((const))
Returns true if this version of i3 is a debug build (anything which is not a release version)...
int main(int argc, char *argv[])
struct autostarts_head autostarts
Con * con_descend_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
int logical_px(const int logical)
Convert a logical amount of pixels (e.g.
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...
void init_dpi(void)
Initialize the DPI setting.
static void xcb_got_event(EV_P_ struct ev_io *w, int revents)
unsigned int xcb_numlock_mask
void translate_keysyms(void)
Translates keysymbols to keycodes for all bindings which use keysyms.
char * fake_outputs
Overwrites output detection (for testing), see src/fake_outputs.c.
bool no_startup_id
no_startup_id flag for start_application().
Con * con
Pointer to the Con which represents this output.
struct ws_assignments_head ws_assignments
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), the user’s one or the system default) and calls parse_file().
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...
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 tree_render(void)
Renders the tree, that is rendering all outputs using render_con() and pushing the changes to X11 usi...
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.
static void xcb_prepare_cb(EV_P_ ev_prepare *w, int revents)
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)
bool disable_randr15
Don’t use RandR 1.5 for querying outputs.
char * command
Command, like in command mode.
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...