- `balance` — Adjust the split ratios so that all windows occupy the same area.
-- `rule PATTERN [DESKTOP_NAME] [floating]` — Create a new rule (`PATTERN` must match the class or instance name).
+- `rule PATTERN [DESKTOP_NAME] [floating] [follow]` — Create a new rule (`PATTERN` must match the class or instance name).
- `remove_rule UID ...` — Remove the rules with the given UIDs.
.B balance
Adjust the split ratios so that all windows occupy the same area.
.TP
-.BI rule " PATTERN [DESKTOP_NAME] [floating]"
+.BI rule " PATTERN [DESKTOP_NAME] [floating] [follow]"
Create a new rule (PATTERN must match the class or instance name).
.TP
.BI remove_rule " UID ..."
while (arg != NULL) {
if (strcmp(arg, "floating") == 0) {
rule->effect.floating = true;
+ } else if (strcmp(arg, "follow") == 0) {
+ rule->effect.follow = true;
} else {
desktop_location_t loc;
if (locate_desktop(arg, &loc)) {
return false;
}
-void handle_rules(xcb_window_t win, monitor_t **m, desktop_t **d, bool *floating, bool *transient, bool *fullscreen, bool *takes_focus, bool *manage)
+void handle_rules(xcb_window_t win, monitor_t **m, desktop_t **d, bool *floating, bool *follow, bool *transient, bool *fullscreen, bool *takes_focus, bool *manage)
{
xcb_ewmh_get_atoms_reply_t win_type;
rule_effect_t efc = rule->effect;
if (efc.floating)
*floating = true;
+ if (efc.follow)
+ *follow = true;
if (efc.monitor != NULL && efc.desktop != NULL) {
*m = efc.monitor;
*d = efc.desktop;
char line[MAXLEN];
for (rule_t *r = rule_head; r != NULL; r = r->next) {
- snprintf(line, sizeof(line), "%02X %s %s %s\n", r->uid, r->cause.name, (r->effect.desktop != NULL ? r->effect.desktop->name : "\b"), (r->effect.floating ? "floating" : "\b"));
+ snprintf(line, sizeof(line), "%2X %s %s %s %s\n", r->uid, r->cause.name, (r->effect.desktop != NULL ? r->effect.desktop->name : "\b"), (r->effect.floating ? "floating" : "\b"), (r->effect.follow ? "follow" : "\b"));
strncat(rsp, line, REMLEN(rsp));
}
}
void remove_rule_by_uid(unsigned int);
rule_t *find_rule(unsigned int);
bool is_match(rule_t *, xcb_window_t);
-void handle_rules(xcb_window_t, monitor_t **, desktop_t **, bool *, bool *, bool *, bool *, bool *);
+void handle_rules(xcb_window_t, monitor_t **, desktop_t **, bool *, bool *, bool *, bool *, bool *, bool *);
void list_rules(char *);
#endif
rule_t *r = malloc(sizeof(rule_t));
r->uid = ++rule_uid;
r->effect.floating = false;
+ r->effect.follow = false;
r->effect.monitor = NULL;
r->effect.desktop = NULL;
r->prev = NULL;
typedef struct {
bool floating;
+ bool follow;
monitor_t *monitor;
desktop_t *desktop;
} rule_effect_t;
if (override_redirect || locate_window(win, &loc))
return;
- bool floating = false, transient = false, fullscreen = false, takes_focus = true, manage = true;
+ bool floating = false, follow = false, transient = false, fullscreen = false, takes_focus = true, manage = true;
- handle_rules(win, &m, &d, &floating, &transient, &fullscreen, &takes_focus, &manage);
+ handle_rules(win, &m, &d, &floating, &follow, &transient, &fullscreen, &takes_focus, &manage);
if (!manage) {
disable_shadow(win);
uint32_t values[] = {(focus_follows_pointer ? CLIENT_EVENT_MASK_FFP : CLIENT_EVENT_MASK)};
xcb_change_window_attributes(dpy, c->window, XCB_CW_EVENT_MASK, values);
+ if (follow) {
+ select_monitor(m);
+ select_desktop(d);
+ }
+
num_clients++;
ewmh_set_wm_desktop(birth, d);
ewmh_update_client_list();