]> git.lizzy.rs Git - bspwm.git/blobdiff - rules.c
Four hyphens is enough
[bspwm.git] / rules.c
diff --git a/rules.c b/rules.c
index f53ea3fcfaebce9a81de98a2ad8cd3ad9097f145..9845bac0b2fa1bcaf8bd303f04042371c27445d6 100644 (file)
--- a/rules.c
+++ b/rules.c
@@ -40,6 +40,17 @@ void remove_rule_by_uid(unsigned int uid)
     remove_rule(find_rule(uid));
 }
 
+void prune_rules(desktop_t *d)
+{
+    rule_t *r = rule_head;
+    while (r != NULL) {
+        rule_t *next = r->next;
+        if (r->effect.desktop == d)
+            remove_rule(r);
+        r = next;
+    }
+}
+
 rule_t *find_rule(unsigned int uid)
 {
     for (rule_t *r = rule_head; r != NULL; r = r->next)
@@ -50,7 +61,7 @@ rule_t *find_rule(unsigned int uid)
 
 bool is_match(rule_t *r, xcb_window_t win)
 {
-    xcb_icccm_get_wm_class_reply_t reply; 
+    xcb_icccm_get_wm_class_reply_t reply;
     if (xcb_icccm_get_wm_class_reply(dpy, xcb_icccm_get_wm_class(dpy, win), &reply, NULL) == 1
             && (strcmp(reply.class_name, r->cause.name) == 0
                 || strcmp(reply.instance_name, r->cause.name) == 0)) {
@@ -60,7 +71,7 @@ bool is_match(rule_t *r, xcb_window_t win)
     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;
 
@@ -113,6 +124,8 @@ void handle_rules(xcb_window_t win, monitor_t **m, desktop_t **d, bool *floating
             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;
@@ -127,7 +140,7 @@ void list_rules(char *rsp)
     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));
     }
 }