return MSG_FAILURE;
}
focus_node(dst.monitor, dst.desktop, dst.node);
+ } else if (streq("-a", *args) || streq("--activate", *args)) {
+ coordinates_t dst = trg;
+ if (num > 1 && *(args + 1)[0] != OPT_CHR) {
+ num--, args++;
+ if (!node_from_desc(*args, &trg, &dst))
+ return MSG_FAILURE;
+ }
+ if (dst.desktop == mon->desk) {
+ return MSG_FAILURE;
+ }
+ activate_node(dst.monitor, dst.desktop, dst.node);
} else if (streq("-d", *args) || streq("--to-desktop", *args)) {
num--, args++;
coordinates_t dst;
} else {
return MSG_FAILURE;
}
- } else if (streq("-t", *args) || streq("--toggle", *args)) {
+ } else if (streq("-t", *args) || streq("--state", *args)) {
+ num--, args++;
+ if (num < 1)
+ return MSG_SYNTAX;
+ client_state_t cst;
+ if (parse_client_state(*args, &cst)) {
+ set_state(trg.monitor, trg.desktop, trg.node, cst);
+ dirty = true;
+ } else {
+ return MSG_FAILURE;
+ }
+ } else if (streq("-g", *args) || streq("--flag", *args)) {
num--, args++;
if (num < 1)
return MSG_SYNTAX;
if (val == NULL) {
a = ALTER_TOGGLE;
} else {
- if (parse_bool(val, &b))
+ if (parse_bool(val, &b)) {
a = ALTER_SET;
- else
+ } else {
return MSG_FAILURE;
+ }
}
- if (streq("fullscreen", key)) {
- set_fullscreen(trg.node, (a == ALTER_SET ? b : !trg.node->client->fullscreen));
- dirty = true;
- } else if (streq("pseudo_tiled", key)) {
- set_pseudo_tiled(trg.node, (a == ALTER_SET ? b : !trg.node->client->pseudo_tiled));
- dirty = true;
- } else if (streq("floating", key)) {
- set_floating(trg.node, (a == ALTER_SET ? b : !trg.node->client->floating));
- dirty = true;
- } else if (streq("locked", key)) {
+ if (streq("locked", key)) {
set_locked(trg.monitor, trg.desktop, trg.node, (a == ALTER_SET ? b : !trg.node->client->locked));
} else if (streq("sticky", key)) {
set_sticky(trg.monitor, trg.desktop, trg.node, (a == ALTER_SET ? b : !trg.node->client->sticky));
num--, args++;
if (num < 1)
return MSG_SYNTAX;
- if (!is_tiled(trg.node->client) ||
+ if (IS_FLOATING(trg.node->client) ||
trg.desktop->layout != LAYOUT_TILED)
return MSG_FAILURE;
if (streq("cancel", *args)) {
num--, args++;
if (num < 2)
return MSG_SYNTAX;
- if (!is_tiled(trg.node->client))
+ if (IS_FLOATING(trg.node->client))
return MSG_FAILURE;
direction_t dir;
if (!parse_direction(*args, &dir))
} else {
return MSG_FAILURE;
}
+ } else if (streq("-l", *args) || streq("--layer", *args)) {
+ num--, args++;
+ if (num < 1) {
+ return MSG_SYNTAX;
+ }
+ stack_layer_t lyr;
+ if (parse_stack_layer(*args, &lyr)) {
+ set_layer(trg.monitor, trg.desktop, trg.node, lyr);
+ } else {
+ return MSG_FAILURE;
+ }
} else if (streq("-R", *args) || streq("--rotate", *args)) {
num--, args++;
if (num < 2)
return MSG_FAILURE;
}
if (auto_alternate && dst.desktop == mon->desk) {
- desktop_select_t sel = {DESKTOP_STATUS_ALL, false, false};
+ desktop_select_t sel = make_desktop_select();
history_find_desktop(HISTORY_OLDER, &trg, &dst, sel);
}
focus_node(dst.monitor, dst.desktop, dst.desktop->focus);
num--, args++;
if (num < 1)
return MSG_SYNTAX;
- put_status(SBSC_MASK_DESKTOP_RENAME, "desktop_rename %s %s %s\n", trg.monitor->name, trg.desktop->name, *args);
- snprintf(trg.desktop->name, sizeof(trg.desktop->name), "%s", *args);
- ewmh_update_desktop_names();
- put_status(SBSC_MASK_REPORT);
+ rename_desktop(trg.monitor, trg.desktop, *args);
} else if (streq("-r", *args) || streq("--remove", *args)) {
if (trg.desktop->root == NULL &&
trg.monitor->desk_head != trg.monitor->desk_tail) {
} else {
return MSG_FAILURE;
}
- } else if (streq("-t", *args) || streq("--toggle", *args)) {
- num--, args++;
- if (num < 1)
- return MSG_SYNTAX;
- char *key = strtok(*args, EQL_TOK);
- char *val = strtok(NULL, EQL_TOK);
- alter_state_t a;
- bool b;
- if (val == NULL) {
- a = ALTER_TOGGLE;
- } else {
- if (parse_bool(val, &b))
- a = ALTER_SET;
- else
- return MSG_FAILURE;
- }
- if (streq("floating", key))
- trg.desktop->floating = (a == ALTER_SET ? b : !trg.desktop->floating);
- else
- return MSG_FAILURE;
- } else {
- return MSG_SYNTAX;
}
num--, args++;
}
return MSG_FAILURE;
}
if (auto_alternate && dst.monitor == mon) {
- desktop_select_t sel = {DESKTOP_STATUS_ALL, false, false};
+ desktop_select_t sel = make_desktop_select();
history_find_monitor(HISTORY_OLDER, &trg, &dst, sel);
}
focus_node(dst.monitor, dst.monitor->desk, dst.monitor->desk->focus);
return MSG_SYNTAX;
desktop_t *d = trg.monitor->desk_head;
while (num > 0 && d != NULL) {
- put_status(SBSC_MASK_DESKTOP_RENAME, "desktop_rename %s %s %s\n", trg.monitor->name, d->name, *args);
- snprintf(d->name, sizeof(d->name), "%s", *args);
+ rename_desktop(trg.monitor, d, *args);
initialize_desktop(d);
arrange(trg.monitor, d);
d = d->next;
}
} else if (streq("-n", *args) || streq("--rename", *args)) {
num--, args++;
- if (num < 1)
+ if (num < 1) {
return MSG_SYNTAX;
- put_status(SBSC_MASK_MONITOR_RENAME, "monitor_rename %s %s\n", trg.monitor->name, *args);
- snprintf(trg.monitor->name, sizeof(trg.monitor->name), "%s", *args);
- put_status(SBSC_MASK_REPORT);
+ }
+ rename_monitor(trg.monitor, *args);
} else if (streq("-s", *args) || streq("--swap", *args)) {
num--, args++;
if (num < 1)
if (loc.desktop != NULL) \
loc.desktop->k = v; \
else if (loc.monitor != NULL) \
- for (desktop_t *d = loc.monitor->desk_head; d != NULL; d = d->next) \
- d->k = v; \
+ return MSG_SYNTAX; \
else \
k = v;
} else if (streq("window_gap", name)) {
SETBOOL(leaf_monocle)
SETBOOL(pointer_follows_focus)
SETBOOL(pointer_follows_monitor)
- SETBOOL(apply_floating_atom)
SETBOOL(auto_alternate)
SETBOOL(auto_cancel)
SETBOOL(history_aware_focus)
else if (streq("window_gap", name))
if (loc.desktop != NULL)
fprintf(rsp, "%i", loc.desktop->window_gap);
+ else if (loc.monitor != NULL)
+ return MSG_SYNTAX;
else
fprintf(rsp, "%i", window_gap);
else if (streq("border_width", name))
GETBOOL(focus_follows_pointer)
GETBOOL(pointer_follows_focus)
GETBOOL(pointer_follows_monitor)
- GETBOOL(apply_floating_atom)
GETBOOL(auto_alternate)
GETBOOL(auto_cancel)
GETBOOL(history_aware_focus)
#undef GETBOOL
else
return MSG_FAILURE;
+ fprintf(rsp, "\n");
return MSG_SUCCESS;
}
*mask = SBSC_MASK_WINDOW_TRANSFER;
} else if (streq("window_focus", s)) {
*mask = SBSC_MASK_WINDOW_FOCUS;
- } else if (streq("window_resize", s)) {
- *mask = SBSC_MASK_WINDOW_RESIZE;
- } else if (streq("window_move", s)) {
- *mask = SBSC_MASK_WINDOW_MOVE;
+ } else if (streq("window_activate", s)) {
+ *mask = SBSC_MASK_WINDOW_ACTIVATE;
+ } else if (streq("window_geometry", s)) {
+ *mask = SBSC_MASK_WINDOW_GEOMETRY;
} else if (streq("window_state", s)) {
*mask = SBSC_MASK_WINDOW_STATE;
+ } else if (streq("window_flag", s)) {
+ *mask = SBSC_MASK_WINDOW_FLAG;
+ } else if (streq("window_layer", s)) {
+ *mask = SBSC_MASK_WINDOW_LAYER;
} else if (streq("desktop_add", s)) {
*mask = SBSC_MASK_DESKTOP_ADD;
} else if (streq("desktop_rename", s)) {
*mask = SBSC_MASK_DESKTOP_FOCUS;
} else if (streq("desktop_layout", s)) {
*mask = SBSC_MASK_DESKTOP_LAYOUT;
- } else if (streq("desktop_state", s)) {
- *mask = SBSC_MASK_DESKTOP_STATE;
} else if (streq("monitor_add", s)) {
*mask = SBSC_MASK_MONITOR_ADD;
} else if (streq("monitor_rename", s)) {
*mask = SBSC_MASK_MONITOR_REMOVE;
} else if (streq("monitor_focus", s)) {
*mask = SBSC_MASK_MONITOR_FOCUS;
- } else if (streq("monitor_resize", s)) {
- *mask = SBSC_MASK_MONITOR_RESIZE;
+ } else if (streq("monitor_geometry", s)) {
+ *mask = SBSC_MASK_MONITOR_GEOMETRY;
} else if (streq("report", s)) {
*mask = SBSC_MASK_REPORT;
} else {
return false;
}
+bool parse_client_state(char *s, client_state_t *t)
+{
+ if (streq("tiled", s)) {
+ *t = STATE_TILED;
+ return true;
+ } else if (streq("pseudo_tiled", s)) {
+ *t = STATE_PSEUDO_TILED;
+ return true;
+ } else if (streq("floating", s)) {
+ *t = STATE_FLOATING;
+ return true;
+ } else if (streq("fullscreen", s)) {
+ *t = STATE_FULLSCREEN;
+ return true;
+ }
+ return false;
+}
+
+bool parse_stack_layer(char *s, stack_layer_t *l)
+{
+ if (streq("below", s)) {
+ *l = LAYER_BELOW;
+ return true;
+ } else if (streq("normal", s)) {
+ *l = LAYER_NORMAL;
+ return true;
+ } else if (streq("above", s)) {
+ *l = LAYER_ABOVE;
+ return true;
+ }
+ return false;
+}
+
bool parse_direction(char *s, direction_t *d)
{
if (streq("right", s)) {