i3
Macros | Functions
workspace.h File Reference
#include "data.h"
#include "tree.h"
#include "randr.h"
Include dependency graph for workspace.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NET_WM_DESKTOP_NONE   0xFFFFFFF0
 
#define NET_WM_DESKTOP_ALL   0xFFFFFFFF
 

Functions

Conworkspace_get (const char *num, bool *created)
 Returns a pointer to the workspace with the given number (starting at 0), creating the workspace if necessary (by allocating the necessary amount of memory and initializing the data structures correctly). More...
 
void extract_workspace_names_from_bindings (void)
 Extracts workspace names from keybindings (e.g. More...
 
Concreate_workspace_on_output (Output *output, Con *content)
 Returns a pointer to a new workspace in the given output. More...
 
bool workspace_is_visible (Con *ws)
 Returns true if the workspace is currently visible. More...
 
void workspace_show (Con *ws)
 Switches to the given workspace. More...
 
void workspace_show_by_name (const char *num)
 Looks up the workspace by name and switches to it. More...
 
Conworkspace_next (void)
 Returns the next workspace. More...
 
Conworkspace_prev (void)
 Returns the previous workspace. More...
 
Conworkspace_next_on_output (void)
 Returns the next workspace on the same output. More...
 
Conworkspace_prev_on_output (void)
 Returns the previous workspace on the same output. More...
 
void workspace_back_and_forth (void)
 Focuses the previously focused workspace. More...
 
Conworkspace_back_and_forth_get (void)
 Returns the previously focused workspace con, or NULL if unavailable. More...
 
void workspace_update_urgent_flag (Con *ws)
 Goes through all clients on the given workspace and updates the workspace’s urgent flag accordingly. More...
 
void ws_force_orientation (Con *ws, orientation_t orientation)
 'Forces' workspace orientation by moving all cons into a new split-con with the same orientation as the workspace and then changing the workspace orientation. More...
 
Conworkspace_attach_to (Con *ws)
 Called when a new con (with a window, not an empty or split con) should be attached to the workspace (for example when managing a new window or when moving an existing window to the workspace level). More...
 
Conworkspace_encapsulate (Con *ws)
 Creates a new container and re-parents all of children from the given workspace into it. More...
 
bool workspace_move_to_output (Con *ws, const char *output)
 Move the given workspace to the specified output. More...
 

Macro Definition Documentation

#define NET_WM_DESKTOP_ALL   0xFFFFFFFF
#define NET_WM_DESKTOP_NONE   0xFFFFFFF0

Function Documentation

Con* create_workspace_on_output ( Output output,
Con content 
)

Returns a pointer to a new workspace in the given output.

The workspace is created attached to the tree hierarchy through the given content container.

Definition at line 175 of file workspace.c.

References _workspace_apply_default_orientation(), binding_workspace_names, CF_OUTPUT, con_attach(), con_new(), config, croot, Config::default_layout, DLOG, Con::fullscreen_mode, GREP_FIRST, LOG, Workspace_Assignment::name, xoutput::name, Con::name, Con::num, Workspace_Assignment::output, output_get_content(), sasprintf(), sstrdup(), TAILQ_FOREACH, Con::type, Con::workspace_layout, ws_assignments, ws_name_to_number(), and x_set_name().

Referenced by init_ws_for_output(), and workspace_move_to_output().

Here is the call graph for this function:

void extract_workspace_names_from_bindings ( void  )

Extracts workspace names from keybindings (e.g.

“web” from “bindsym $mod+1 workspace web”), so that when an output needs a workspace, i3 can start with the first configured one. Needs to be called before reorder_bindings() so that the config-file order is used, not the i3-internal order.

Definition at line 121 of file workspace.c.

References binding_workspace_names, bindings, Binding::command, DLOG, FREE, LOG, parse_string(), srealloc(), and TAILQ_FOREACH.

Referenced by parse_file().

Here is the call graph for this function:

Con* workspace_attach_to ( Con ws)

Called when a new con (with a window, not an empty or split con) should be attached to the workspace (for example when managing a new window or when moving an existing window to the workspace level).

Depending on the workspace_layout setting, this function either returns the workspace itself (default layout) or creates a new stacked/tabbed con and returns that.

Definition at line 851 of file workspace.c.

References con_attach(), con_fix_percent(), con_new(), DLOG, L_DEFAULT, Con::layout, Con::name, and Con::workspace_layout.

Referenced by _con_attach(), and insert_con_into().

Here is the call graph for this function:

void workspace_back_and_forth ( void  )

Focuses the previously focused workspace.

Definition at line 751 of file workspace.c.

References DLOG, previous_workspace_name, and workspace_show_by_name().

Referenced by cmd_workspace_back_and_forth(), and maybe_back_and_forth().

Here is the call graph for this function:

Con* workspace_back_and_forth_get ( void  )

Returns the previously focused workspace con, or NULL if unavailable.

Definition at line 764 of file workspace.c.

References DLOG, previous_workspace_name, and workspace_get().

Referenced by cmd_move_con_to_workspace_back_and_forth(), and maybe_auto_back_and_forth_workspace().

Here is the call graph for this function:

Con* workspace_encapsulate ( Con ws)

Creates a new container and re-parents all of children from the given workspace into it.

The container inherits the layout from the workspace.

Definition at line 883 of file workspace.c.

References con_attach(), con_detach(), con_new(), DLOG, ELOG, Con::layout, Con::name, TAILQ_EMPTY, and TAILQ_FIRST.

Referenced by _con_move_to_con(), and tree_split().

Here is the call graph for this function:

Con* workspace_get ( const char *  num,
bool *  created 
)

Returns a pointer to the workspace with the given number (starting at 0), creating the workspace if necessary (by allocating the necessary amount of memory and initializing the data structures correctly).

If created is not NULL, *created will be set to whether or not the workspace has just been created.

Definition at line 50 of file workspace.c.

References _workspace_apply_default_orientation(), con_attach(), con_get_output(), con_new(), config, croot, Config::default_layout, DLOG, ewmh_update_desktop_names(), ewmh_update_desktop_viewport(), ewmh_update_number_of_desktops(), ewmh_update_wm_desktop(), focused, FREE, GREP_FIRST, ipc_send_workspace_event(), LOG, Workspace_Assignment::name, Con::name, Con::num, Workspace_Assignment::output, output_get_content(), Con::parent, sasprintf(), sstrdup(), TAILQ_FOREACH, Con::type, Con::workspace_layout, ws_assignments, ws_name_to_number(), and x_set_name().

Referenced by cmd_focus(), cmd_move_con_to_workspace_name(), cmd_move_con_to_workspace_number(), manage_window(), scratchpad_fix_resolution(), scratchpad_move(), scratchpad_show(), workspace_back_and_forth_get(), workspace_move_to_output(), and workspace_show_by_name().

Here is the call graph for this function:

bool workspace_is_visible ( Con ws)

Returns true if the workspace is currently visible.

Especially important for multi-monitor environments, as they can have multiple currenlty active workspaces.

Definition at line 256 of file workspace.c.

References CF_OUTPUT, con_get_fullscreen_con(), con_get_output(), LOG, and Workspace_Assignment::output.

Referenced by _con_move_to_con(), _tree_next(), _workspace_show(), cmd_focus_output(), cmd_move_con_to_output(), con_on_remove_child(), con_set_layout(), handle_client_message(), init_ws_for_output(), IPC_HANDLER(), manage_window(), move_to_output_directed(), output_push_sticky_windows(), and workspace_move_to_output().

Here is the call graph for this function:

bool workspace_move_to_output ( Con ws,
const char *  name 
)
Con* workspace_next ( void  )

Returns the next workspace.

Definition at line 509 of file workspace.c.

References con_get_workspace(), con_is_internal(), croot, focused, NODES_FOREACH, Con::num, Workspace_Assignment::output, output_get_content(), TAILQ_FOREACH, and TAILQ_NEXT.

Referenced by cmd_move_con_to_workspace(), and cmd_workspace().

Here is the call graph for this function:

Con* workspace_next_on_output ( void  )

Returns the next workspace on the same output.

Definition at line 639 of file workspace.c.

References con_get_output(), con_get_workspace(), focused, NODES_FOREACH, Con::num, Workspace_Assignment::output, output_get_content(), and TAILQ_NEXT.

Referenced by cmd_move_con_to_workspace(), and cmd_workspace().

Here is the call graph for this function:

Con* workspace_prev ( void  )

Returns the previous workspace.

Definition at line 572 of file workspace.c.

References con_get_workspace(), con_is_internal(), croot, focused, NODES_FOREACH_REVERSE, Con::num, Workspace_Assignment::output, output_get_content(), TAILQ_FOREACH_REVERSE, and TAILQ_PREV.

Referenced by cmd_move_con_to_workspace(), and cmd_workspace().

Here is the call graph for this function:

Con* workspace_prev_on_output ( void  )

Returns the previous workspace on the same output.

Definition at line 694 of file workspace.c.

References con_get_output(), con_get_workspace(), DLOG, focused, Con::name, NODES_FOREACH_REVERSE, Con::num, Workspace_Assignment::output, output_get_content(), and TAILQ_PREV.

Referenced by cmd_move_con_to_workspace(), and cmd_workspace().

Here is the call graph for this function:

void workspace_show ( Con ws)
void workspace_show_by_name ( const char *  num)

Looks up the workspace by name and switches to it.

Definition at line 499 of file workspace.c.

References _workspace_show(), and workspace_get().

Referenced by cmd_workspace_name(), cmd_workspace_number(), init_ws_for_output(), and workspace_back_and_forth().

Here is the call graph for this function:

void workspace_update_urgent_flag ( Con ws)

Goes through all clients on the given workspace and updates the workspace’s urgent flag accordingly.

Definition at line 794 of file workspace.c.

References DLOG, get_urgency_flag(), ipc_send_workspace_event(), and Con::urgent.

Referenced by _con_move_to_con(), con_focus(), con_set_urgency(), tree_close_internal(), and workspace_defer_update_urgent_hint_cb().

Here is the call graph for this function:

void ws_force_orientation ( Con ws,
orientation_t  orientation 
)

'Forces' workspace orientation by moving all cons into a new split-con with the same orientation as the workspace and then changing the workspace orientation.

Definition at line 808 of file workspace.c.

References con_attach(), con_detach(), con_fix_percent(), con_focus(), con_new(), DLOG, HORIZ, L_SPLITH, L_SPLITV, Con::layout, Con::parent, TAILQ_EMPTY, and TAILQ_FIRST.

Referenced by tree_move().

Here is the call graph for this function: