return NULL;
}
+/**
+ * Returns true if the container is internal, such as __i3_scratch
+ *
+ */
+bool con_is_internal(Con *con) {
+ return (con->name[0] == '_' && con->name[1] == '_');
+}
+
/*
* Returns true if the node is floating.
*
* calling tree_render(), so for the "real" focus this is a no-op).
* We don’t focus the con for i3 pseudo workspaces like __i3_scratch and
* we don’t focus when there is a fullscreen con on that workspace. */
- if ((workspace->name[0] != '_' || workspace->name[1] != '_') &&
+ if (!con_is_internal(workspace) &&
con_get_fullscreen_con(workspace, CF_OUTPUT) == NULL)
con_focus(con_descend_focused(con));
* don’t want to focus invisible workspaces */
if (source_output != dest_output &&
workspace_is_visible(workspace) &&
- workspace->name[0] != '_' &&
- workspace->name[1] != '_') {
+ !con_is_internal(workspace)) {
DLOG("Moved to a different output, focusing target\n");
} else {
/* Descend focus stack in case focus_next is a workspace which can
if (con->layout == L_OUTPUT) {
/* Skip i3-internal outputs */
- if (con->name[0] == '_' && con->name[1] == '_')
+ if (con_is_internal(con))
return;
render_l_output(con);
} else if (con->type == CT_ROOT) {
* windows/containers so that they overlap on another output. */
DLOG("Rendering floating windows:\n");
TAILQ_FOREACH(output, &(con->nodes_head), nodes) {
- if (output->name[0] == '_' && output->name[1] == '_')
+ if (con_is_internal(output))
continue;
/* Get the active workspace of that output */
Con *content = output_get_content(output);
Con *current, *old = NULL;
/* safe-guard against showing i3-internal workspaces like __i3_scratch */
- if (workspace->name[0] == '_' && workspace->name[1] == '_')
+ if (con_is_internal(workspace))
return;
/* disable fullscreen for the other workspaces and get the workspace we are
/* If currently a numbered workspace, find next numbered workspace. */
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
/* Skip outputs starting with __, they are internal. */
- if (output->name[0] == '_' && output->name[1] == '_')
+ if (con_is_internal(output))
continue;
NODES_FOREACH(output_get_content(output)) {
if (child->type != CT_WORKSPACE)
bool found_current = false;
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
/* Skip outputs starting with __, they are internal. */
- if (output->name[0] == '_' && output->name[1] == '_')
+ if (con_is_internal(output))
continue;
NODES_FOREACH(output_get_content(output)) {
if (child->type != CT_WORKSPACE)
if (!next) {
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
/* Skip outputs starting with __, they are internal. */
- if (output->name[0] == '_' && output->name[1] == '_')
+ if (con_is_internal(output))
continue;
NODES_FOREACH(output_get_content(output)) {
if (child->type != CT_WORKSPACE)
/* If numbered workspace, find previous numbered workspace. */
TAILQ_FOREACH_REVERSE(output, &(croot->nodes_head), nodes_head, nodes) {
/* Skip outputs starting with __, they are internal. */
- if (output->name[0] == '_' && output->name[1] == '_')
+ if (con_is_internal(output))
continue;
NODES_FOREACH_REVERSE(output_get_content(output)) {
if (child->type != CT_WORKSPACE || child->num == -1)
bool found_current = false;
TAILQ_FOREACH_REVERSE(output, &(croot->nodes_head), nodes_head, nodes) {
/* Skip outputs starting with __, they are internal. */
- if (output->name[0] == '_' && output->name[1] == '_')
+ if (con_is_internal(output))
continue;
NODES_FOREACH_REVERSE(output_get_content(output)) {
if (child->type != CT_WORKSPACE)
if (!prev) {
TAILQ_FOREACH_REVERSE(output, &(croot->nodes_head), nodes_head, nodes) {
/* Skip outputs starting with __, they are internal. */
- if (output->name[0] == '_' && output->name[1] == '_')
+ if (con_is_internal(output))
continue;
NODES_FOREACH_REVERSE(output_get_content(output)) {
if (child->type != CT_WORKSPACE)