*/
void workspace_set_name(Workspace *ws, const char *name);
+/**
+ * Returns true if the workspace is currently visible. Especially important for
+ * multi-monitor environments, as they can have multiple currenlty active
+ * workspaces.
+ *
+ */
+bool workspace_is_visible(Workspace *ws);
+
#endif
#include "floating.h"
#include "xcb.h"
#include "config.h"
+#include "workspace.h"
bool focus_window_in_container(xcb_connection_t *conn, Container *container, direction_t direction) {
/* If this container is empty, we’re done */
floating_assign_to_workspace(client, t_ws);
- bool target_invisible = t_ws->screen->current_workspace != t_ws->num;
-
/* If we’re moving it to an invisible screen, we need to unmap it */
- if (target_invisible) {
+ if (!workspace_is_visible(t_ws)) {
LOG("This workspace is not visible, unmapping\n");
xcb_unmap_window(conn, client->frame);
} else {
render_layout(conn);
- if (!target_invisible)
+ if (workspace_is_visible(t_ws))
set_focus(conn, client, true);
}
container->currently_focused = to_focus;
to_container->currently_focused = current_client;
- bool target_invisible = (to_container->workspace->screen->current_workspace != to_container->workspace->num);
-
/* If we’re moving it to an invisible screen, we need to unmap it */
- if (target_invisible) {
+ if (!workspace_is_visible(to_container->workspace)) {
LOG("This workspace is not visible, unmapping\n");
xcb_unmap_window(conn, current_client->frame);
} else {
render_layout(conn);
- if (!target_invisible)
+ if (workspace_is_visible(to_container->workspace))
set_focus(conn, current_client, true);
}
#include "manage.h"
#include "floating.h"
#include "client.h"
+#include "workspace.h"
/*
* Go through all existing windows (if the window manager is restarted) and manage them
break;
}
- LOG("Changin container/workspace and unmapping the client\n");
+ LOG("Changing container/workspace and unmapping the client\n");
Workspace *t_ws = &(workspaces[assign->workspace-1]);
if (t_ws->screen == NULL) {
LOG("initializing new workspace, setting num to %d\n", assign->workspace);
new->workspace = t_ws;
old_focused = new->container->currently_focused;
- map_frame = false;
+ map_frame = workspace_is_visible(t_ws);
break;
}
}
free(label);
}
+
+/*
+ * Returns true if the workspace is currently visible. Especially important for
+ * multi-monitor environments, as they can have multiple currenlty active
+ * workspaces.
+ *
+ */
+bool workspace_is_visible(Workspace *ws) {
+ return (ws->screen->current_workspace == ws->num);
+}