i3
|
Go to the source code of this file.
Macros | |
#define | HANDLE_EMPTY_MATCH |
When the command did not include match criteria (!), we use the currently focused command. |
Functions | |
static bool | definitelyGreaterThan (float a, float b, float epsilon) |
static Output * | get_output_from_string (Output *current_output, const char *output_str) |
void | cmd_criteria_init (I3_CMD) |
Initializes the specified 'Match' data structure and the initial state of commands.c for matching target windows of a command. | |
void | cmd_criteria_match_windows (I3_CMD) |
A match specification just finished (the closing square bracket was found), so we filter the list of owindows. | |
void | cmd_criteria_add (I3_CMD, char *ctype, char *cvalue) |
Interprets a ctype=cvalue pair and adds it to the current match specification. | |
void | cmd_move_con_to_workspace (I3_CMD, char *which) |
Implementation of 'move [window|container] [to] workspace next|prev|next_on_output|prev_on_output'. | |
void | cmd_move_con_to_workspace_name (I3_CMD, char *name) |
Implementation of 'move [window|container] [to] workspace <name>'. | |
void | cmd_move_con_to_workspace_number (I3_CMD, char *which) |
Implementation of 'move [window|container] [to] workspace number <number>'. | |
static void | cmd_resize_floating (I3_CMD, char *way, char *direction, Con *floating_con, int px) |
static void | cmd_resize_tiling_direction (I3_CMD, char *way, char *direction, int ppt) |
static void | cmd_resize_tiling_width_height (I3_CMD, char *way, char *direction, int ppt) |
void | cmd_resize (I3_CMD, char *way, char *direction, char *resize_px, char *resize_ppt) |
Implementation of 'resize grow|shrink <direction> [<px> px] [or <ppt> ppt]'. | |
void | cmd_border (I3_CMD, char *border_style_str) |
Implementation of 'border normal|none|1pixel|toggle'. | |
void | cmd_nop (I3_CMD, char *comment) |
Implementation of 'nop <comment>'. | |
void | cmd_append_layout (I3_CMD, char *path) |
Implementation of 'append_layout <path>'. | |
void | cmd_workspace (I3_CMD, char *which) |
Implementation of 'workspace next|prev|next_on_output|prev_on_output'. | |
void | cmd_workspace_number (I3_CMD, char *which) |
Implementation of 'workspace number <number>'. | |
void | cmd_workspace_back_and_forth (I3_CMD) |
Implementation of 'workspace back_and_forth'. | |
void | cmd_workspace_name (I3_CMD, char *name) |
Implementation of 'workspace <name>'. | |
void | cmd_mark (I3_CMD, char *mark) |
Implementation of 'mark <mark>'. | |
void | cmd_mode (I3_CMD, char *mode) |
Implementation of 'mode <string>'. | |
void | cmd_move_con_to_output (I3_CMD, char *name) |
Implementation of 'move [window|container] [to] output <str>'. | |
void | cmd_floating (I3_CMD, char *floating_mode) |
Implementation of 'floating enable|disable|toggle'. | |
void | cmd_move_workspace_to_output (I3_CMD, char *name) |
Implementation of 'move workspace to [output] <str>'. | |
void | cmd_split (I3_CMD, char *direction) |
Implementation of 'split v|h|vertical|horizontal'. | |
void | cmd_kill (I3_CMD, char *kill_mode_str) |
Implementaiton of 'kill [window|client]'. | |
void | cmd_exec (I3_CMD, char *nosn, char *command) |
Implementation of 'exec [–no-startup-id] <command>'. | |
void | cmd_focus_direction (I3_CMD, char *direction) |
Implementation of 'focus left|right|up|down'. | |
void | cmd_focus_window_mode (I3_CMD, char *window_mode) |
Implementation of 'focus tiling|floating|mode_toggle'. | |
void | cmd_focus_level (I3_CMD, char *level) |
Implementation of 'focus parent|child'. | |
void | cmd_focus (I3_CMD) |
Implementation of 'focus'. | |
void | cmd_fullscreen (I3_CMD, char *fullscreen_mode) |
Implementation of 'fullscreen [global]'. | |
void | cmd_move_direction (I3_CMD, char *direction, char *move_px) |
Implementation of 'move <direction> [<pixels> [px]]'. | |
void | cmd_layout (I3_CMD, char *layout_str) |
Implementation of 'layout default|stacked|stacking|tabbed'. | |
void | cmd_exit (I3_CMD) |
Implementaiton of 'exit'. | |
void | cmd_reload (I3_CMD) |
Implementaiton of 'reload'. | |
void | cmd_restart (I3_CMD) |
Implementaiton of 'restart'. | |
void | cmd_open (I3_CMD) |
Implementaiton of 'open'. | |
void | cmd_focus_output (I3_CMD, char *name) |
Implementation of 'focus output <output>'. | |
void | cmd_move_window_to_position (I3_CMD, char *method, char *cx, char *cy) |
Implementation of 'move [window|container] [to] [absolute] position <px> [px] <px> [px]. | |
void | cmd_move_window_to_center (I3_CMD, char *method) |
Implementation of 'move [window|container] [to] [absolute] position center. | |
void | cmd_move_scratchpad (I3_CMD) |
Implementation of 'move scratchpad'. | |
void | cmd_scratchpad_show (I3_CMD) |
Implementation of 'scratchpad show'. | |
void | cmd_rename_workspace (I3_CMD, char *old_name, char *new_name) |
Implementation of 'rename workspace <name> to <name>'. |
Variables | |
static owindows_head | owindows |
#define HANDLE_EMPTY_MATCH |
When the command did not include match criteria (!), we use the currently focused command.
Do not confuse this case with a command which included criteria but which did not match any windows. This macro has to be called in every command.
Definition at line 20 of file commands.c.
Referenced by cmd_border(), cmd_floating(), cmd_focus_output(), cmd_fullscreen(), cmd_mark(), cmd_move_con_to_output(), cmd_move_con_to_workspace(), cmd_move_con_to_workspace_name(), cmd_move_con_to_workspace_number(), cmd_move_scratchpad(), and cmd_move_workspace_to_output().
void cmd_append_layout | ( | I3_CMD | , |
char * | path | ||
) |
Implementation of 'append_layout <path>'.
Definition at line 692 of file commands.c.
References LOG, sstrdup(), and tree_append_json().
Referenced by GENERATED_call().
void cmd_border | ( | I3_CMD | , |
char * | border_style_str | ||
) |
Implementation of 'border normal|none|1pixel|toggle'.
Definition at line 645 of file commands.c.
References Con::border_style, BS_1PIXEL, BS_NONE, BS_NORMAL, owindow::con, con_set_border_style(), DLOG, ELOG, HANDLE_EMPTY_MATCH, Con::name, owindows, sstrdup(), and TAILQ_FOREACH.
Referenced by GENERATED_call().
void cmd_criteria_add | ( | I3_CMD | , |
char * | ctype, | ||
char * | cvalue | ||
) |
Interprets a ctype=cvalue pair and adds it to the current match specification.
Definition at line 246 of file commands.c.
References Match::class, Match::con_id, current_match, DLOG, ELOG, Match::id, Match::instance, Match::mark, regex_new(), Match::role, Match::title, and Match::urgent.
Referenced by GENERATED_call().
void cmd_criteria_init | ( | I3_CMD | ) |
Initializes the specified 'Match' data structure and the initial state of commands.c for matching target windows of a command.
Definition at line 173 of file commands.c.
References all_cons, owindow::con, current_match, DLOG, match_init(), owindows, smalloc(), TAILQ_EMPTY, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_INIT, TAILQ_INSERT_TAIL, and TAILQ_REMOVE.
Referenced by GENERATED_call(), and parse_command().
void cmd_criteria_match_windows | ( | I3_CMD | ) |
A match specification just finished (the closing square bracket was found), so we filter the list of owindows.
Definition at line 198 of file commands.c.
References owindow::con, Match::con_id, current_match, DLOG, Match::mark, Con::mark, match_matches_window(), Con::name, owindows, regex_matches(), TAILQ_END, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_INIT, TAILQ_INSERT_TAIL, TAILQ_NEXT, and Con::window.
Referenced by GENERATED_call().
void cmd_exec | ( | I3_CMD | , |
char * | nosn, | ||
char * | command | ||
) |
Implementation of 'exec [–no-startup-id] <command>'.
Definition at line 1086 of file commands.c.
References DLOG, sstrdup(), and start_application().
Referenced by GENERATED_call().
void cmd_exit | ( | I3_CMD | ) |
Implementaiton of 'exit'.
Definition at line 1348 of file commands.c.
References LOG.
Referenced by GENERATED_call().
void cmd_floating | ( | I3_CMD | , |
char * | floating_mode | ||
) |
Implementation of 'floating enable|disable|toggle'.
Definition at line 914 of file commands.c.
References owindow::con, DLOG, floating_disable(), floating_enable(), HANDLE_EMPTY_MATCH, Con::name, owindows, sstrdup(), TAILQ_FOREACH, and toggle_floating_mode().
Referenced by GENERATED_call().
void cmd_focus | ( | I3_CMD | ) |
Implementation of 'focus'.
Definition at line 1197 of file commands.c.
References owindow::con, con_focus(), con_get_workspace(), current_match, DLOG, ELOG, focused, Con::fullscreen_mode, LOG, match_is_empty(), Con::name, owindows, sasprintf(), sstrdup(), TAILQ_FOREACH, Con::type, and workspace_show().
Referenced by GENERATED_call().
void cmd_focus_direction | ( | I3_CMD | , |
char * | direction | ||
) |
Implementation of 'focus left|right|up|down'.
Definition at line 1100 of file commands.c.
References DLOG, ELOG, focused, Con::fullscreen_mode, HORIZ, LOG, sstrdup(), tree_next(), Con::type, and VERT.
Referenced by GENERATED_call().
void cmd_focus_level | ( | I3_CMD | , |
char * | level | ||
) |
Implementation of 'focus parent|child'.
Definition at line 1173 of file commands.c.
References DLOG, focused, Con::fullscreen_mode, level_down(), level_up(), LOG, sstrdup(), and Con::type.
Referenced by GENERATED_call().
void cmd_focus_output | ( | I3_CMD | , |
char * | name | ||
) |
Implementation of 'focus output <output>'.
Definition at line 1401 of file commands.c.
References owindow::con, xoutput::con, DLOG, get_output_containing(), get_output_from_string(), GREP_FIRST, HANDLE_EMPTY_MATCH, LOG, Workspace_Assignment::output, output_get_content(), owindows, Con::rect, sstrdup(), TAILQ_FOREACH, workspace_is_visible(), workspace_show(), Rect::x, and Rect::y.
Referenced by GENERATED_call().
void cmd_focus_window_mode | ( | I3_CMD | , |
char * | window_mode | ||
) |
Implementation of 'focus tiling|floating|mode_toggle'.
Definition at line 1134 of file commands.c.
References con_descend_focused(), con_focus(), con_get_workspace(), DLOG, focused, Con::fullscreen_mode, LOG, sstrdup(), TAILQ_FIRST, TAILQ_FOREACH, and Con::type.
Referenced by GENERATED_call().
void cmd_fullscreen | ( | I3_CMD | , |
char * | fullscreen_mode | ||
) |
Implementation of 'fullscreen [global]'.
Definition at line 1263 of file commands.c.
References owindow::con, con_toggle_fullscreen(), DLOG, HANDLE_EMPTY_MATCH, Con::name, owindows, sstrdup(), and TAILQ_FOREACH.
Referenced by GENERATED_call().
void cmd_kill | ( | I3_CMD | , |
char * | kill_mode_str | ||
) |
Implementaiton of 'kill [window|client]'.
Definition at line 1049 of file commands.c.
References owindow::con, current_match, DLOG, ELOG, KILL_CLIENT, KILL_WINDOW, match_is_empty(), Con::name, owindows, sstrdup(), TAILQ_FOREACH, tree_close(), and tree_close_con().
Referenced by GENERATED_call().
void cmd_layout | ( | I3_CMD | , |
char * | layout_str | ||
) |
Implementation of 'layout default|stacked|stacking|tabbed'.
Definition at line 1320 of file commands.c.
References owindow::con, con_set_layout(), current_match, DLOG, focused, match_is_empty(), Con::name, owindows, Con::parent, sstrdup(), and TAILQ_FOREACH.
Referenced by GENERATED_call().
void cmd_mark | ( | I3_CMD | , |
char * | mark | ||
) |
Implementation of 'mark <mark>'.
Definition at line 817 of file commands.c.
References all_cons, owindow::con, DLOG, FREE, HANDLE_EMPTY_MATCH, Con::mark, Con::name, owindows, sstrdup(), and TAILQ_FOREACH.
Referenced by GENERATED_call().
void cmd_mode | ( | I3_CMD | , |
char * | mode | ||
) |
Implementation of 'mode <string>'.
Definition at line 845 of file commands.c.
References DLOG, sstrdup(), and switch_mode().
Referenced by GENERATED_call().
void cmd_move_con_to_output | ( | I3_CMD | , |
char * | name | ||
) |
Implementation of 'move [window|container] [to] output <str>'.
Definition at line 857 of file commands.c.
References owindow::con, xoutput::con, con_move_to_workspace(), D_DOWN, D_LEFT, D_RIGHT, D_UP, DLOG, get_output_by_name(), get_output_containing(), get_output_next(), GREP_FIRST, HANDLE_EMPTY_MATCH, LOG, Con::name, output_get_content(), owindows, Con::rect, sstrdup(), TAILQ_FOREACH, workspace_is_visible(), Rect::x, and Rect::y.
Referenced by GENERATED_call().
void cmd_move_con_to_workspace | ( | I3_CMD | , |
char * | which | ||
) |
Implementation of 'move [window|container] [to] workspace next|prev|next_on_output|prev_on_output'.
Definition at line 325 of file commands.c.
References owindow::con, con_move_to_workspace(), DLOG, ELOG, HANDLE_EMPTY_MATCH, Con::name, owindows, sstrdup(), TAILQ_FOREACH, workspace_next(), workspace_next_on_output(), workspace_prev(), and workspace_prev_on_output().
Referenced by GENERATED_call().
void cmd_move_con_to_workspace_name | ( | I3_CMD | , |
char * | name | ||
) |
Implementation of 'move [window|container] [to] workspace <name>'.
Definition at line 362 of file commands.c.
References owindow::con, con_move_to_workspace(), current_match, DLOG, focused, HANDLE_EMPTY_MATCH, LOG, match_is_empty(), Con::name, owindows, sstrdup(), TAILQ_FOREACH, Con::type, and workspace_get().
Referenced by GENERATED_call().
void cmd_move_con_to_workspace_number | ( | I3_CMD | , |
char * | which | ||
) |
Implementation of 'move [window|container] [to] workspace number <number>'.
Definition at line 398 of file commands.c.
References owindow::con, con_move_to_workspace(), croot, current_match, DLOG, focused, GREP_FIRST, HANDLE_EMPTY_MATCH, LOG, match_is_empty(), Con::name, Con::num, output_get_content(), owindows, sstrdup(), TAILQ_FOREACH, and Con::type.
Referenced by GENERATED_call().
void cmd_move_direction | ( | I3_CMD | , |
char * | direction, | ||
char * | move_px | ||
) |
Implementation of 'move <direction> [<pixels> [px]]'.
Definition at line 1285 of file commands.c.
References con_is_floating(), D_DOWN, D_LEFT, D_RIGHT, D_UP, DLOG, floating_reposition(), focused, Con::parent, Con::rect, sstrdup(), tree_move(), Rect::x, and Rect::y.
Referenced by GENERATED_call().
void cmd_move_scratchpad | ( | I3_CMD | ) |
Implementation of 'move scratchpad'.
Definition at line 1522 of file commands.c.
References owindow::con, DLOG, HANDLE_EMPTY_MATCH, Con::name, owindows, scratchpad_move(), sstrdup(), and TAILQ_FOREACH.
Referenced by GENERATED_call().
void cmd_move_window_to_center | ( | I3_CMD | , |
char * | method | ||
) |
Implementation of 'move [window|container] [to] [absolute] position center.
Definition at line 1483 of file commands.c.
References con_get_workspace(), con_is_floating(), croot, DLOG, ELOG, floating_maybe_reassign_ws(), floating_reposition(), focused, Rect::height, Con::parent, Con::rect, sasprintf(), sstrdup(), Rect::width, Rect::x, and Rect::y.
Referenced by GENERATED_call().
void cmd_move_window_to_position | ( | I3_CMD | , |
char * | method, | ||
char * | x, | ||
char * | y | ||
) |
Implementation of 'move [window|container] [to] [absolute] position <px> [px] <px> [px].
Definition at line 1443 of file commands.c.
References con_is_floating(), DLOG, ELOG, floating_maybe_reassign_ws(), floating_reposition(), focused, Con::parent, Con::rect, sasprintf(), sstrdup(), Rect::x, x, Rect::y, and y.
Referenced by GENERATED_call().
void cmd_move_workspace_to_output | ( | I3_CMD | , |
char * | name | ||
) |
Implementation of 'move workspace to [output] <str>'.
Definition at line 945 of file commands.c.
References owindow::con, xoutput::con, con_attach(), con_detach(), con_get_workspace(), con_num_children(), create_workspace_on_output(), croot, DLOG, floating_fix_coordinates(), get_output_containing(), get_output_from_string(), GREP_FIRST, HANDLE_EMPTY_MATCH, ipc_send_event(), LOG, Workspace_Assignment::name, xoutput::name, Con::name, Workspace_Assignment::output, output_get_content(), owindows, Con::parent, Con::rect, sstrdup(), TAILQ_FIRST, TAILQ_FOREACH, workspace_get(), workspace_is_visible(), workspace_show(), ws_assignments, Rect::x, and Rect::y.
Referenced by GENERATED_call().
void cmd_nop | ( | I3_CMD | , |
char * | comment | ||
) |
Implementation of 'nop <comment>'.
Definition at line 682 of file commands.c.
References LOG.
Referenced by GENERATED_call().
void cmd_open | ( | I3_CMD | ) |
Implementaiton of 'open'.
Definition at line 1387 of file commands.c.
References con_focus(), LOG, sasprintf(), and tree_open_con().
Referenced by GENERATED_call().
void cmd_reload | ( | I3_CMD | ) |
Implementaiton of 'reload'.
Definition at line 1359 of file commands.c.
References conn, ipc_send_event(), kill_configerror_nagbar(), load_configuration(), LOG, sstrdup(), and x_set_i3_atoms().
Referenced by GENERATED_call().
void cmd_rename_workspace | ( | I3_CMD | , |
char * | old_name, | ||
char * | new_name | ||
) |
Implementation of 'rename workspace <name> to <name>'.
Definition at line 1564 of file commands.c.
References con_attach(), con_detach(), con_focus(), croot, focused, FREE, GREP_FIRST, ipc_send_event(), LOG, Con::name, Con::num, Workspace_Assignment::output, output_get_content(), Con::parent, sstrdup(), and TAILQ_FOREACH.
Referenced by GENERATED_call().
void cmd_resize | ( | I3_CMD | , |
char * | way, | ||
char * | direction, | ||
char * | resize_px, | ||
char * | resize_ppt | ||
) |
Implementation of 'resize grow|shrink <direction> [<px> px] [or <ppt> ppt]'.
Definition at line 615 of file commands.c.
References cmd_resize_floating(), cmd_resize_tiling_direction(), cmd_resize_tiling_width_height(), con_inside_floating(), current_match, DLOG, focused, and sstrdup().
Referenced by GENERATED_call().
|
static |
Definition at line 446 of file commands.c.
References Rect::height, LOG, Con::rect, Rect::width, Rect::x, and Rect::y.
Referenced by cmd_resize().
|
static |
Definition at line 461 of file commands.c.
References con_num_children(), definitelyGreaterThan(), focused, HORIZ, Con::layout, LOG, Con::orientation, Con::parent, Con::percent, sstrdup(), TAILQ_END, TAILQ_NEXT, TAILQ_PREV, Con::type, and VERT.
Referenced by cmd_resize().
|
static |
Definition at line 530 of file commands.c.
References con_num_children(), definitelyGreaterThan(), focused, HORIZ, Con::layout, LOG, Con::orientation, Con::parent, Con::percent, sstrdup(), TAILQ_FOREACH, Con::type, and VERT.
Referenced by cmd_resize().
void cmd_restart | ( | I3_CMD | ) |
Implementaiton of 'restart'.
Definition at line 1375 of file commands.c.
References i3_restart(), LOG, and sstrdup().
Referenced by GENERATED_call().
void cmd_scratchpad_show | ( | I3_CMD | ) |
Implementation of 'scratchpad show'.
Definition at line 1542 of file commands.c.
References owindow::con, current_match, DLOG, match_is_empty(), Con::name, owindows, scratchpad_show(), sstrdup(), and TAILQ_FOREACH.
Referenced by GENERATED_call().
void cmd_split | ( | I3_CMD | , |
char * | direction | ||
) |
Implementation of 'split v|h|vertical|horizontal'.
Definition at line 1035 of file commands.c.
References focused, HORIZ, LOG, sstrdup(), tree_split(), and VERT.
Referenced by GENERATED_call().
void cmd_workspace | ( | I3_CMD | , |
char * | which | ||
) |
Implementation of 'workspace next|prev|next_on_output|prev_on_output'.
Definition at line 705 of file commands.c.
References DLOG, ELOG, sstrdup(), workspace_next(), workspace_next_on_output(), workspace_prev(), workspace_prev_on_output(), and workspace_show().
Referenced by GENERATED_call().
void cmd_workspace_back_and_forth | ( | I3_CMD | ) |
Implementation of 'workspace back_and_forth'.
Definition at line 772 of file commands.c.
References sstrdup(), and workspace_back_and_forth().
Referenced by GENERATED_call().
void cmd_workspace_name | ( | I3_CMD | , |
char * | name | ||
) |
Implementation of 'workspace <name>'.
Definition at line 784 of file commands.c.
References con_get_workspace(), config, DLOG, focused, LOG, Con::name, sstrdup(), tree_render(), Config::workspace_auto_back_and_forth, workspace_back_and_forth(), and workspace_show_by_name().
Referenced by GENERATED_call().
void cmd_workspace_number | ( | I3_CMD | , |
char * | which | ||
) |
Implementation of 'workspace number <number>'.
Definition at line 735 of file commands.c.
References croot, GREP_FIRST, LOG, Con::num, output_get_content(), sstrdup(), TAILQ_FOREACH, and workspace_show().
Referenced by GENERATED_call().
|
static |
Definition at line 35 of file commands.c.
Referenced by cmd_resize_tiling_direction(), and cmd_resize_tiling_width_height().
Definition at line 44 of file commands.c.
References D_DOWN, D_LEFT, D_RIGHT, D_UP, get_output_by_name(), get_output_most(), and get_output_next().
Referenced by cmd_focus_output(), and cmd_move_workspace_to_output().
|
static |
Definition at line 29 of file commands.c.
Referenced by cmd_border(), cmd_criteria_init(), cmd_criteria_match_windows(), cmd_floating(), cmd_focus(), cmd_focus_output(), cmd_fullscreen(), cmd_kill(), cmd_layout(), cmd_mark(), cmd_move_con_to_output(), cmd_move_con_to_workspace(), cmd_move_con_to_workspace_name(), cmd_move_con_to_workspace_number(), cmd_move_scratchpad(), cmd_move_workspace_to_output(), and cmd_scratchpad_show().