]> git.lizzy.rs Git - bspwm.git/blobdiff - rules.c
Add '--follow' option to 'send_to*' messages
[bspwm.git] / rules.c
diff --git a/rules.c b/rules.c
index cb41354d91fb8d724da4f6a8098928342fdf73ba..6feb17fac22adad72ae13a8b300f88be9e89b04e 100644 (file)
--- a/rules.c
+++ b/rules.c
@@ -19,7 +19,7 @@ bool is_match(rule_t *r, xcb_window_t win)
     return false;
 }
 
-void handle_rules(xcb_window_t win, bool *floating, bool *transient, bool *fullscreen, bool *takes_focus, desktop_t **send_to)
+void handle_rules(xcb_window_t win, monitor_t **m, desktop_t **d, bool *floating, bool *transient, bool *fullscreen, bool *takes_focus, bool *manage)
 {
     xcb_ewmh_get_atoms_reply_t win_type;
 
@@ -31,11 +31,22 @@ void handle_rules(xcb_window_t win, bool *floating, bool *transient, bool *fulls
                 *takes_focus = false;
             } else if (a == ewmh->_NET_WM_WINDOW_TYPE_DIALOG) {
                 *floating = true;
+            } else if (a == ewmh->_NET_WM_WINDOW_TYPE_DOCK || a == ewmh->_NET_WM_WINDOW_TYPE_NOTIFICATION) {
+                *manage = false;
             }
         }
         xcb_ewmh_get_atoms_reply_wipe(&win_type);
     }
 
+    xcb_size_hints_t size_hints;
+
+    if (xcb_icccm_get_wm_normal_hints_reply(dpy, xcb_icccm_get_wm_normal_hints(dpy, win), &size_hints, NULL) == 1) {
+        if (size_hints.min_width > 0 && size_hints.min_height > 0
+                && size_hints.min_width == size_hints.max_width
+                && size_hints.min_height == size_hints.max_height)
+            *floating = true;
+    }
+
     xcb_ewmh_get_atoms_reply_t win_state;
 
     if (xcb_ewmh_get_wm_state_reply(ewmh, xcb_ewmh_get_wm_state(ewmh, win), &win_state, NULL) == 1) {
@@ -58,11 +69,12 @@ void handle_rules(xcb_window_t win, bool *floating, bool *transient, bool *fulls
 
     while (rule != NULL) {
         if (is_match(rule, win)) {
-            if (rule->effect.floating)
+            rule_effect_t efc = rule->effect;
+            if (efc.floating)
                 *floating = true;
-            if (rule->effect.send_to != NULL) {
-                *send_to = rule->effect.send_to;
-                rule->effect.send_to = NULL;      /* serve only once */
+            if (efc.monitor != NULL && efc.desktop != NULL) {
+                *m = efc.monitor;
+                *d = efc.desktop;
             }
         }
         rule = rule->next;