]> git.mdlowis.com Git - proto/labwc.git/commitdiff
query: add window type filter for if-actions
authorTobias Bengfort <tobias.bengfort@posteo.de>
Sat, 20 Apr 2024 05:57:35 +0000 (07:57 +0200)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sat, 18 May 2024 19:04:08 +0000 (20:04 +0100)
docs/labwc-actions.5.scd
include/view.h
src/config/rcxml.c
src/view.c

index 4f0492b627a99258544fe2424749b449537ea189..db0ce5cd00a1d0c8c4343c4ce01190fe3ba4e544 100644 (file)
@@ -316,6 +316,10 @@ Actions that execute other actions. Used in keyboard/mouse bindings.
                        XDG shell title for Wayland clients, WM_NAME for
                        XWayland clients.
 
+               *type*
+                       Internal heuristics for Wayland clients,
+                       NET_WM_WINDOW_TYPE for XWayland clients.
+
                This argument is optional.
 
        *then*
index 5ab5d0027cd6fa35eda6f510515b5851cd7ba06d..cb7e70dc48beb3439491789ec0bf41d36213aacb 100644 (file)
@@ -266,6 +266,7 @@ struct view_query {
        struct wl_list link;
        char *identifier;
        char *title;
+       int window_type;
 };
 
 struct xdg_toplevel_view {
index c2863819a7fb043d29f95694da4a843d0ec5a950..9884d41a33d0b391980d2f2b9607ad95ccc9618b 100644 (file)
@@ -316,6 +316,8 @@ fill_action_query(char *nodename, char *content, struct action *action)
                current_view_query->identifier = xstrdup(content);
        } else if (!strcasecmp(nodename, "title")) {
                current_view_query->title = xstrdup(content);
+       } else if (!strcmp(nodename, "type")) {
+               current_view_query->window_type = parse_window_type(content);
        }
 }
 
index b10a39aed49d56d259e69eba49c405cd8c648f30..74f5faf698f6616a6e8b8c89b012c91c85b6df8d 100644 (file)
@@ -80,6 +80,11 @@ view_matches_query(struct view *view, struct view_query *query)
                match &= match_glob(query->title, title);
        }
 
+       if (match && query->window_type >= 0) {
+               empty = false;
+               match &= view_contains_window_type(view, query->window_type);
+       }
+
        return !empty && match;
 }