4 * i3 - an improved dynamic tiling window manager
6 * © 2009 Michael Stapelberg and contributors
8 * See file LICENSE for license information.
10 * workspace.c: Functions for modifying workspaces
24 * Sets the name (or just its number) for the given workspace. This has to
25 * be called for every workspace as the rendering function
26 * (render_internal_bar) relies on workspace->name and workspace->name_len
30 void workspace_set_name(Workspace *ws, const char *name) {
35 ret = asprintf(&label, "%d: %s", ws->num + 1, name);
36 else ret = asprintf(&label, "%d", ws->num + 1);
39 errx(1, "asprintf() failed");
43 ws->name = convert_utf8_to_ucs2(label, &(ws->name_len));
44 ws->text_width = predict_text_width(global_conn, config.font, ws->name, ws->name_len);
50 * Returns true if the workspace is currently visible. Especially important for
51 * multi-monitor environments, as they can have multiple currenlty active
55 bool workspace_is_visible(Workspace *ws) {
56 return (ws->screen->current_workspace == ws->num);