|
i3
|


Go to the source code of this file.
Macros | |
| #define | die(...) errx(EXIT_FAILURE, __VA_ARGS__); |
| #define | exit_if_null(pointer, ...) |
| #define | STARTS_WITH(string, needle) (strncasecmp((string), (needle), strlen((needle))) == 0) |
| #define | CIRCLEQ_NEXT_OR_NULL(head, elm, field) (CIRCLEQ_NEXT(elm, field) != CIRCLEQ_END(head) ? CIRCLEQ_NEXT(elm, field) : NULL) |
| #define | CIRCLEQ_PREV_OR_NULL(head, elm, field) (CIRCLEQ_PREV(elm, field) != CIRCLEQ_END(head) ? CIRCLEQ_PREV(elm, field) : NULL) |
| #define | FOR_TABLE(workspace) |
| #define | NODES_FOREACH(head) |
| #define | NODES_FOREACH_REVERSE(head) |
| #define | GREP_FIRST(dest, head, condition) |
| #define | FREE(pointer) |
| #define | CALL(obj, member, ...) obj->member(obj, ##__VA_ARGS__) |
Functions | |
| int | min (int a, int b) |
| int | max (int a, int b) |
| bool | rect_contains (Rect rect, uint32_t x, uint32_t y) |
| Rect | rect_add (Rect a, Rect b) |
| Rect | rect_sub (Rect a, Rect b) |
| __attribute__ ((pure)) bool name_is_digits(const char *name) | |
| Returns true if the name consists of only digits. More... | |
| bool | layout_from_name (const char *layout_str, layout_t *out) |
| Set 'out' to the layout_t value for the given layout. More... | |
| long | ws_name_to_number (const char *name) |
| Parses the workspace name as a number. More... | |
| bool | update_if_necessary (uint32_t *destination, const uint32_t new_value) |
| Updates *destination with new_value and returns true if it was changed or false if it was the same. More... | |
| void | exec_i3_utility (char *name, char *argv[]) |
| exec()s an i3 utility, for example the config file migration script or i3-nagbar. More... | |
| bool | path_exists (const char *path) |
| Checks if the given path exists by calling stat(). More... | |
| void | i3_restart (bool forget_layout) |
| Restart i3 in-place appends -a to argument list to disable autostart. More... | |
| char * | pango_escape_markup (char *input) |
| Escapes the given string if a pango font is currently used. More... | |
| void | start_nagbar (pid_t *nagbar_pid, char *argv[]) |
| Starts an i3-nagbar instance with the given parameters. More... | |
| void | kill_nagbar (pid_t *nagbar_pid, bool wait_for_it) |
| Kills the i3-nagbar process, if *nagbar_pid != -1. More... | |
| bool | parse_long (const char *str, long *out, int base) |
| Converts a string into a long using strtol(). More... | |
| ssize_t | slurp (const char *path, char **buf) |
| Slurp reads path in its entirety into buf, returning the length of the file or -1 if the file could not be read. More... | |
| #define CALL | ( | obj, | |
| member, | |||
| ... | |||
| ) | obj->member(obj, ##__VA_ARGS__) |
Definition at line 58 of file util.h.
Referenced by _con_move_to_con(), attach_to_workspace(), insert_con_into(), tree_close_internal(), and workspace_move_to_output().
| #define CIRCLEQ_NEXT_OR_NULL | ( | head, | |
| elm, | |||
| field | |||
| ) | (CIRCLEQ_NEXT(elm, field) != CIRCLEQ_END(head) ? CIRCLEQ_NEXT(elm, field) : NULL) |
| #define CIRCLEQ_PREV_OR_NULL | ( | head, | |
| elm, | |||
| field | |||
| ) | (CIRCLEQ_PREV(elm, field) != CIRCLEQ_END(head) ? CIRCLEQ_PREV(elm, field) : NULL) |
| #define die | ( | ... | ) | errx(EXIT_FAILURE, __VA_ARGS__); |
Definition at line 19 of file util.h.
Referenced by get_first_output(), main(), parse_configuration(), and parse_file().
| #define exit_if_null | ( | pointer, | |
| ... | |||
| ) |
| #define FOR_TABLE | ( | workspace | ) |
| #define FREE | ( | pointer | ) |
Definition at line 50 of file util.h.
Referenced by _con_move_to_con(), _create___i3(), _workspace_show(), binding_free(), CFGFUN(), cmd_criteria_match_windows(), cmd_rename_workspace(), cmd_title_format(), command_result_free(), con_force_split_parents_redraw(), con_free(), con_parse_title_format(), con_unmark(), configure_binding(), extract_workspace_names_from_bindings(), floating_move_to_pointer(), handle_client_message(), handle_normal_hints(), handle_output(), handle_windowname_change(), handle_windowname_change_legacy(), ipc_create_socket(), ipc_receive_message(), json_end_map(), json_key(), load_configuration(), main(), manage_window(), match_free(), migrate_config(), move_to_output_directed(), output_init_con(), pango_escape_markup(), parse_configuration(), parse_file(), property_notify(), randr_query_outputs(), randr_query_outputs_14(), randr_query_outputs_15(), regex_free(), regrab_all_buttons(), render_con(), startup_sequence_delete(), startup_sequence_get(), switch_mode(), TAILQ_HEAD(), translate_keysyms(), tree_close_internal(), tree_init(), tree_move(), upsert_variable(), window_free(), window_update_class(), window_update_hints(), window_update_leader(), window_update_motif_hints(), window_update_name(), window_update_name_legacy(), window_update_role(), window_update_strut_partial(), window_update_transient_for(), workspace_defer_update_urgent_hint_cb(), workspace_get(), x_con_kill(), x_draw_decoration(), x_push_node(), x_set_name(), xcb_drag_check_cb(), xcb_remove_property_atom(), and xinerama_init().
| #define GREP_FIRST | ( | dest, | |
| head, | |||
| condition | |||
| ) |
Definition at line 41 of file util.h.
Referenced by _tree_next(), cmd_focus_output(), cmd_move_con_to_output(), cmd_move_con_to_workspace_number(), cmd_rename_workspace(), cmd_workspace_number(), con_move_to_output(), create_workspace_on_output(), init_ws_for_output(), json_end_map(), move_to_output_directed(), output_push_sticky_windows(), workspace_get(), and workspace_move_to_output().
| #define NODES_FOREACH | ( | head | ) |
Definition at line 32 of file util.h.
Referenced by workspace_next(), and workspace_next_on_output().
| #define NODES_FOREACH_REVERSE | ( | head | ) |
Definition at line 36 of file util.h.
Referenced by workspace_prev(), and workspace_prev_on_output().
| #define STARTS_WITH | ( | string, | |
| needle | |||
| ) | (strncasecmp((string), (needle), strlen((needle))) == 0) |
Definition at line 25 of file util.h.
Referenced by ewmh_update_desktop_names(), ewmh_update_desktop_viewport(), and ewmh_update_number_of_desktops().
| __attribute__ | ( | (pure) | ) | const |
Returns true if the name consists of only digits.
| void exec_i3_utility | ( | char * | name, |
| char * | argv[] | ||
| ) |
exec()s an i3 utility, for example the config file migration script or i3-nagbar.
This function first searches $PATH for the given utility named, then falls back to the dirname() of the i3 executable path and then falls back to the dirname() of the target of /proc/self/exe (on linux).
This function should be called after fork()ing.
The first argument of the given argv vector will be overwritten with the executable name, so pass NULL.
If the utility cannot be found in any of these locations, it exits with return code 2.
Definition at line 142 of file util.c.
References sasprintf(), sstrdup(), and start_argv.
Referenced by migrate_config(), and start_nagbar().

| void i3_restart | ( | bool | forget_layout | ) |
Restart i3 in-place appends -a to argument list to disable autostart.
Definition at line 282 of file util.c.
References add_argument(), command_error_nagbar_pid, config_error_nagbar_pid, get_debug_logging(), ipc_shutdown(), kill_nagbar(), LOG, restore_geometry(), SHUTDOWN_REASON_RESTART, start_argv, and store_restart_layout().
Referenced by cmd_restart(), and sighandler_handle_key_press().

| void kill_nagbar | ( | pid_t * | nagbar_pid, |
| bool | wait_for_it | ||
| ) |
Kills the i3-nagbar process, if *nagbar_pid != -1.
If wait_for_it is set (restarting i3), this function will waitpid(), otherwise, ev is assumed to handle it (reloading).
Definition at line 445 of file util.c.
Referenced by cmd_reload(), and i3_restart().
| bool layout_from_name | ( | const char * | layout_str, |
| layout_t * | out | ||
| ) |
Set 'out' to the layout_t value for the given layout.
The function returns true on success or false if the passed string is not a valid layout name.
Definition at line 75 of file util.c.
References L_DEFAULT, L_SPLITH, L_SPLITV, L_STACKED, and L_TABBED.
Referenced by cmd_layout(), and con_toggle_layout().
| int max | ( | int | a, |
| int | b | ||
| ) |
Definition at line 31 of file util.c.
Referenced by con_minimum_size(), DRAGGING_CB(), floating_check_size(), floating_enable(), and json_end_map().
| int min | ( | int | a, |
| int | b | ||
| ) |
Definition at line 27 of file util.c.
Referenced by con_minimum_size(), fake_outputs_init(), floating_check_size(), open_logbuffer(), query_screens(), and randr_query_outputs().
| char* pango_escape_markup | ( | char * | input | ) |
Escapes the given string if a pango font is currently used.
If the string has to be escaped, the input string will be free'd.
Definition at line 352 of file util.c.
References font_is_pango(), and FREE.
Referenced by con_parse_title_format().

| bool parse_long | ( | const char * | str, |
| long * | out, | ||
| int | base | ||
| ) |
Converts a string into a long using strtol().
This is a convenience wrapper checking the parsing result. It returns true if the number could be parsed.
Definition at line 467 of file util.c.
Referenced by bindings_get_buttons_to_grab(), cmd_swap(), configure_binding(), match_parse_property(), and translate_keysyms().
| bool path_exists | ( | const char * | path | ) |
Checks if the given path exists by calling stat().
Definition at line 178 of file util.c.
Referenced by ipc_create_socket(), and tree_restore().
Definition at line 42 of file util.c.
References Rect::height, Rect::width, Rect::x, and Rect::y.
Referenced by con_set_border_style(), and render_con().
| bool rect_contains | ( | Rect | rect, |
| uint32_t | x, | ||
| uint32_t | y | ||
| ) |
Definition at line 35 of file util.c.
References Rect::height, Rect::width, Rect::x, and Rect::y.
Referenced by handle_button_press(), handle_enter_notify(), and handle_motion_notify().
Definition at line 49 of file util.c.
References Rect::height, Rect::width, Rect::x, and Rect::y.
Referenced by con_set_border_style().
| ssize_t slurp | ( | const char * | path, |
| char ** | buf | ||
| ) |
Slurp reads path in its entirety into buf, returning the length of the file or -1 if the file could not be read.
buf is set to a buffer of appropriate size, or NULL if -1 is returned.
Definition at line 485 of file util.c.
References ELOG, and scalloc().
Referenced by cmd_append_layout(), and tree_restore().

| void start_nagbar | ( | pid_t * | nagbar_pid, |
| char * | argv[] | ||
| ) |
Starts an i3-nagbar instance with the given parameters.
Takes care of handling SIGCHLD and killing i3-nagbar when i3 exits.
The resulting PID will be stored in *nagbar_pid and can be used with kill_nagbar() to kill the bar later on.
Definition at line 405 of file util.c.
References DLOG, exec_i3_utility(), main_loop, nagbar_cleanup(), nagbar_exited(), and smalloc().
Referenced by run_binding(), and start_config_error_nagbar().

| bool update_if_necessary | ( | uint32_t * | destination, |
| const uint32_t | new_value | ||
| ) |
Updates *destination with new_value and returns true if it was changed or false if it was the same.
Definition at line 121 of file util.c.
Referenced by handle_output(), randr_query_outputs(), and randr_query_outputs_15().
| long ws_name_to_number | ( | const char * | name | ) |
Parses the workspace name as a number.
Returns -1 if the workspace should be interpreted as a "named workspace".
Definition at line 102 of file util.c.
Referenced by cmd_move_con_to_workspace_number(), cmd_rename_workspace(), cmd_workspace_number(), create_workspace_on_output(), json_end_map(), and workspace_get().
1.8.13