char *value = strtok(NULL, TOKEN_SEP);
set_setting(name, value, rsp);
return;
- } else if (strcmp(cmd, "dump") == 0) {
+ } else if (strcmp(cmd, "list") == 0) {
dump_tree(mon->desk, mon->desk->root, rsp, 0);
return;
} else if (strcmp(cmd, "list_monitors") == 0) {
if (parse_list_option(arg, &opt))
list_monitors(opt, rsp);
return;
- } else if (strcmp(cmd, "list") == 0) {
+ } else if (strcmp(cmd, "list_desktops") == 0) {
char *arg = strtok(NULL, TOKEN_SEP);
list_option_t opt;
if (parse_list_option(arg, &opt))
list_desktops(mon, opt, 0, rsp);
return;
- } else if (strcmp(cmd, "windows") == 0) {
+ } else if (strcmp(cmd, "list_windows") == 0) {
list_windows(rsp);
return;
} else if (strcmp(cmd, "close") == 0) {
return;
} else if (strcmp(cmd, "kill") == 0) {
window_kill(mon->desk, mon->desk->focus);
- } else if (strcmp(cmd, "magnetise") == 0) {
- char *cor = strtok(NULL, TOKEN_SEP);
- if (cor != NULL) {
- corner_t c;
- if (parse_corner(cor, &c)) {
- magnetise_tree(mon->desk->root, c);
- }
- }
} else if (strcmp(cmd, "rotate") == 0) {
char *deg = strtok(NULL, TOKEN_SEP);
if (deg != NULL) {
} else if (strcmp(cmd, "layout") == 0) {
char *lyt = strtok(NULL, TOKEN_SEP);
if (lyt != NULL) {
- layout_t l;
- if (parse_layout(lyt, &l)) {
- mon->desk->layout = l;
+ layout_t y;
+ if (parse_layout(lyt, &y)) {
+ char *name = strtok(NULL, TOKEN_SEP);
+ if (name == NULL) {
+ mon->desk->layout = y;
+ } else {
+ desktop_location_t loc;
+ do {
+ if (locate_desktop(name, &loc))
+ loc.desktop->layout = y;
+ } while ((name = strtok(NULL, TOKEN_SEP)) != NULL);
+ }
}
}
} else if (strcmp(cmd, "cycle_layout") == 0) {
char *dir = strtok(NULL, TOKEN_SEP);
if (dir != NULL) {
cycle_dir_t d;
- if (parse_cycle_direction(dir, &d))
- cycle_desktop(d);
+ if (parse_cycle_direction(dir, &d)) {
+ skip_desktop_t k;
+ char *skip = strtok(NULL, TOKEN_SEP);
+ if (parse_skip_desktop(skip, &k))
+ cycle_desktop(mon, mon->desk, d, k);
+ }
+ }
+ } else if (strcmp(cmd, "cycle") == 0) {
+ if (mon->desk->focus != NULL && mon->desk->focus->client->fullscreen)
+ return;
+ char *dir = strtok(NULL, TOKEN_SEP);
+ if (dir != NULL) {
+ cycle_dir_t d;
+ if (parse_cycle_direction(dir, &d)) {
+ skip_client_t k;
+ char *skip = strtok(NULL, TOKEN_SEP);
+ if (parse_skip_client(skip, &k))
+ cycle_leaf(mon, mon->desk, mon->desk->focus, d, k);
+ }
}
+ return;
} else if (strcmp(cmd, "nearest") == 0) {
if (mon->desk->focus != NULL && mon->desk->focus->client->fullscreen)
return;
}
}
return;
- } else if (strcmp(cmd, "cycle") == 0) {
- if (mon->desk->focus != NULL && mon->desk->focus->client->fullscreen)
+ } else if (strcmp(cmd, "circulate") == 0) {
+ if (mon->desk->layout == LAYOUT_MONOCLE
+ || (mon->desk->focus != NULL && !is_tiled(mon->desk->focus->client)))
return;
char *dir = strtok(NULL, TOKEN_SEP);
if (dir != NULL) {
- cycle_dir_t d;
- if (parse_cycle_direction(dir, &d)) {
- skip_client_t k;
- char *skip = strtok(NULL, TOKEN_SEP);
- if (parse_skip_client(skip, &k))
- cycle_leaf(mon, mon->desk, mon->desk->focus, d, k);
- }
+ circulate_dir_t d;
+ if (parse_circulate_direction(dir, &d))
+ circulate_leaves(mon, mon->desk, d);
}
- return;
} else if (strcmp(cmd, "rule") == 0) {
char *name = strtok(NULL, TOKEN_SEP);
if (name != NULL) {
return;
} else if (strcmp(cmd, "alternate") == 0) {
focus_node(mon, mon->desk, mon->desk->last_focus, true);
+ return;
} else if (strcmp(cmd, "alternate_desktop") == 0) {
select_desktop(mon->last_desk);
} else if (strcmp(cmd, "alternate_monitor") == 0) {
focus_node(mon, mon->desk, n, true);
}
}
- return;
+ if (mon->desk->layout == LAYOUT_TILED)
+ return;
+ } else if (strcmp(cmd, "adopt_orphans") == 0) {
+ adopt_orphans();
} else if (strcmp(cmd, "reload") == 0) {
load_settings();
run_autostart();
bool b;
if (parse_bool(value, &b))
borderless_monocle = b;
+ } else if (strcmp(name, "gapless_monocle") == 0) {
+ bool b;
+ if (parse_bool(value, &b))
+ gapless_monocle = b;
} else if (strcmp(name, "focus_follows_mouse") == 0) {
bool b;
if (parse_bool(value, &b))
return;
} else if (strcmp(name, "button_modifier") == 0) {
unsigned int m;
- if (parse_modifier_mask(value, &m))
+ if (parse_modifier_mask(value, &m)) {
+ ungrab_buttons();
button_modifier = m;
+ grab_buttons();
+ }
return;
} else {
snprintf(rsp, BUFSIZ, "unknown setting: %s", name);
snprintf(rsp, BUFSIZ, "%s (%06X)", urgent_border_color, urgent_border_color_pxl);
else if (strcmp(name, "borderless_monocle") == 0)
snprintf(rsp, BUFSIZ, "%s", BOOLSTR(borderless_monocle));
+ else if (strcmp(name, "gapless_monocle") == 0)
+ snprintf(rsp, BUFSIZ, "%s", BOOLSTR(gapless_monocle));
else if (strcmp(name, "focus_follows_mouse") == 0)
snprintf(rsp, BUFSIZ, "%s", BOOLSTR(focus_follows_mouse));
else if (strcmp(name, "wm_name") == 0)
snprintf(rsp, BUFSIZ, "%s", wm_name);
+ else if (strcmp(name, "button_modifier") == 0)
+ print_modifier_mask(rsp, button_modifier);
else
snprintf(rsp, BUFSIZ, "unknown setting: %s", name);
}
return false;
}
+bool parse_circulate_direction(char *s, circulate_dir_t *d)
+{
+ if (strcmp(s, "forward") == 0) {
+ *d = CIRCULATE_FORWARD;
+ return true;
+ } else if (strcmp(s, "backward") == 0) {
+ *d = CIRCULATE_BACKWARD;
+ return true;
+ }
+ return false;
+}
+
bool parse_skip_client(char *s, skip_client_t *k)
{
- if (s == NULL || strcmp(s, "--skip-none") == 0) {
- *k = SKIP_NONE;
+ if (s == NULL) {
+ *k = CLIENT_SKIP_NONE;
return true;
} else if (strcmp(s, "--skip-floating") == 0) {
- *k = SKIP_FLOATING;
+ *k = CLIENT_SKIP_FLOATING;
return true;
} else if (strcmp(s, "--skip-tiled") == 0) {
- *k = SKIP_TILED;
+ *k = CLIENT_SKIP_TILED;
return true;
} else if (strcmp(s, "--skip-class-equal") == 0) {
- *k = SKIP_CLASS_EQUAL;
+ *k = CLIENT_SKIP_CLASS_EQUAL;
return true;
} else if (strcmp(s, "--skip-class-differ") == 0) {
- *k = SKIP_CLASS_DIFFER;
+ *k = CLIENT_SKIP_CLASS_DIFFER;
return true;
}
return false;
}
-bool parse_list_option(char *s, list_option_t *o)
+bool parse_skip_desktop(char *s, skip_desktop_t *k)
{
- if (s == NULL || strcmp(s, "--verbose") == 0) {
- *o = LIST_OPTION_VERBOSE;
+ if (s == NULL) {
+ *k = DESKTOP_SKIP_NONE;
return true;
- } else if (strcmp(s, "--quiet") == 0) {
- *o = LIST_OPTION_QUIET;
+ } else if (strcmp(s, "--skip-free") == 0) {
+ *k = DESKTOP_SKIP_FREE;
+ return true;
+ } else if (strcmp(s, "--skip-occupied") == 0) {
+ *k = DESKTOP_SKIP_OCCUPIED;
return true;
}
return false;
}
-bool parse_corner(char *s, corner_t *c)
+bool parse_list_option(char *s, list_option_t *o)
{
- if (strcmp(s, "top_left") == 0) {
- *c = TOP_LEFT;
- return true;
- } else if (strcmp(s, "top_right") == 0) {
- *c = TOP_RIGHT;
- return true;
- } else if (strcmp(s, "bottom_left") == 0) {
- *c = BOTTOM_LEFT;
+ if (s == NULL || strcmp(s, "--verbose") == 0) {
+ *o = LIST_OPTION_VERBOSE;
return true;
- } else if (strcmp(s, "bottom_right") == 0) {
- *c = BOTTOM_RIGHT;
+ } else if (strcmp(s, "--quiet") == 0) {
+ *o = LIST_OPTION_QUIET;
return true;
}
return false;
}
return false;
}
+
+void print_modifier_mask(char *s, unsigned int m)
+{
+ switch(m) {
+ case XCB_MOD_MASK_1:
+ snprintf(s, BUFSIZ, "mod1");
+ break;
+ case XCB_MOD_MASK_2:
+ snprintf(s, BUFSIZ, "mod2");
+ break;
+ case XCB_MOD_MASK_3:
+ snprintf(s, BUFSIZ, "mod3");
+ break;
+ case XCB_MOD_MASK_4:
+ snprintf(s, BUFSIZ, "mod4");
+ break;
+ case XCB_MOD_MASK_5:
+ snprintf(s, BUFSIZ, "mod5");
+ break;
+ }
+}