mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
query: add window type filter for if-actions
This commit is contained in:
parent
b9b870cfa7
commit
7bc3cae91a
4 changed files with 12 additions and 0 deletions
|
|
@ -316,6 +316,10 @@ Actions that execute other actions. Used in keyboard/mouse bindings.
|
||||||
XDG shell title for Wayland clients, WM_NAME for
|
XDG shell title for Wayland clients, WM_NAME for
|
||||||
XWayland clients.
|
XWayland clients.
|
||||||
|
|
||||||
|
*type*
|
||||||
|
Internal heuristics for Wayland clients,
|
||||||
|
NET_WM_WINDOW_TYPE for XWayland clients.
|
||||||
|
|
||||||
This argument is optional.
|
This argument is optional.
|
||||||
|
|
||||||
*then*
|
*then*
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,7 @@ struct view_query {
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
char *identifier;
|
char *identifier;
|
||||||
char *title;
|
char *title;
|
||||||
|
int window_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct xdg_toplevel_view {
|
struct xdg_toplevel_view {
|
||||||
|
|
|
||||||
|
|
@ -316,6 +316,8 @@ fill_action_query(char *nodename, char *content, struct action *action)
|
||||||
current_view_query->identifier = xstrdup(content);
|
current_view_query->identifier = xstrdup(content);
|
||||||
} else if (!strcasecmp(nodename, "title")) {
|
} else if (!strcasecmp(nodename, "title")) {
|
||||||
current_view_query->title = xstrdup(content);
|
current_view_query->title = xstrdup(content);
|
||||||
|
} else if (!strcmp(nodename, "type")) {
|
||||||
|
current_view_query->window_type = parse_window_type(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,11 @@ view_matches_query(struct view *view, struct view_query *query)
|
||||||
match &= match_glob(query->title, title);
|
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;
|
return !empty && match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue