mirror of
https://github.com/labwc/labwc.git
synced 2026-04-11 08:21:13 -04:00
query: added "monitor" option
This commit is contained in:
parent
9181ea1e6f
commit
66373a5fdd
3 changed files with 15 additions and 5 deletions
|
|
@ -301,6 +301,7 @@ struct view_query {
|
||||||
char *tiled_region;
|
char *tiled_region;
|
||||||
char *desktop;
|
char *desktop;
|
||||||
enum ssd_mode decoration;
|
enum ssd_mode decoration;
|
||||||
|
char *monitor;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct xdg_toplevel_view {
|
struct xdg_toplevel_view {
|
||||||
|
|
|
||||||
|
|
@ -495,6 +495,8 @@ fill_action_query(char *nodename, char *content, struct action *action)
|
||||||
current_view_query->desktop = xstrdup(content);
|
current_view_query->desktop = xstrdup(content);
|
||||||
} else if (!strcasecmp(nodename, "decoration")) {
|
} else if (!strcasecmp(nodename, "decoration")) {
|
||||||
current_view_query->decoration = ssd_mode_parse(content);
|
current_view_query->decoration = ssd_mode_parse(content);
|
||||||
|
} else if (!strcasecmp(nodename, "monitor")) {
|
||||||
|
current_view_query->monitor = xstrdup(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
17
src/view.c
17
src/view.c
|
|
@ -86,6 +86,7 @@ view_query_free(struct view_query *query)
|
||||||
zfree(query->sandbox_app_id);
|
zfree(query->sandbox_app_id);
|
||||||
zfree(query->tiled_region);
|
zfree(query->tiled_region);
|
||||||
zfree(query->desktop);
|
zfree(query->desktop);
|
||||||
|
zfree(query->monitor);
|
||||||
zfree(query);
|
zfree(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -195,7 +196,7 @@ view_matches_query(struct view *view, struct view_query *query)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query->tiled != VIEW_EDGE_INVALID) {
|
if (query->tiled != VIEW_EDGE_INVALID) {
|
||||||
match = (query->tiled == view->tiled) ? LAB_STATE_ENABLED : LAB_STATE_DISABLED;
|
match = bool_to_tristate(query->tiled == view->tiled);
|
||||||
wlr_log(WLR_DEBUG, "tiled: %d\n", match);
|
wlr_log(WLR_DEBUG, "tiled: %d\n", match);
|
||||||
if (match == LAB_STATE_DISABLED) {
|
if (match == LAB_STATE_DISABLED) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -203,10 +204,8 @@ view_matches_query(struct view *view, struct view_query *query)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query->tiled_region) {
|
if (query->tiled_region) {
|
||||||
match = (view->tiled_region &&
|
match = bool_to_tristate(view->tiled_region &&
|
||||||
!strcasecmp(query->tiled_region, view->tiled_region->name))
|
!strcasecmp(query->tiled_region, view->tiled_region->name));
|
||||||
? LAB_STATE_ENABLED
|
|
||||||
: LAB_STATE_DISABLED;
|
|
||||||
wlr_log(WLR_DEBUG, "tiled_region: %d\n", match);
|
wlr_log(WLR_DEBUG, "tiled_region: %d\n", match);
|
||||||
if (match == LAB_STATE_DISABLED) {
|
if (match == LAB_STATE_DISABLED) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -238,6 +237,14 @@ view_matches_query(struct view *view, struct view_query *query)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (query->monitor) {
|
||||||
|
struct output *target = output_from_name(view->server, query->monitor);
|
||||||
|
match = bool_to_tristate(target == view->output);
|
||||||
|
if (match == LAB_STATE_DISABLED) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return match == LAB_STATE_ENABLED;
|
return match == LAB_STATE_ENABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue