mirror of
https://github.com/swaywm/sway.git
synced 2026-04-24 06:46:22 -04:00
Add trigger information to criteria
This allows writing commands like "for_window [trigger="map",workspace="1"]" that only execute if the criteria matches during the initial mapping of the window. Currently implemented trigger names: - command: explicit invocation by a command, not very useful - map: initial window creation - mark, title, app_id, class, window_role, window_type: the given property changed
This commit is contained in:
parent
2c76923282
commit
9c30140b0a
8 changed files with 36 additions and 21 deletions
|
|
@ -34,6 +34,7 @@ struct criteria {
|
|||
struct pattern *shell;
|
||||
struct pattern *app_id;
|
||||
struct pattern *con_mark;
|
||||
char *trigger; // event that triggered this criteria match
|
||||
uint32_t con_id; // internal ID
|
||||
#if HAVE_XWAYLAND
|
||||
struct pattern *class;
|
||||
|
|
@ -71,11 +72,11 @@ struct criteria *criteria_parse(char *raw, char **error);
|
|||
*
|
||||
* Criteria types can be bitwise ORed.
|
||||
*/
|
||||
list_t *criteria_for_view(struct sway_view *view, enum criteria_type types);
|
||||
list_t *criteria_for_view(struct sway_view *view, enum criteria_type types, const char* trigger);
|
||||
|
||||
/**
|
||||
* Compile a list of containers matching the given criteria.
|
||||
*/
|
||||
list_t *criteria_get_containers(struct criteria *criteria);
|
||||
list_t *criteria_get_containers(struct criteria *criteria, const char* trigger);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ void view_update_title(struct sway_view *view, bool force);
|
|||
* Run any criteria that match the view and haven't been run on this view
|
||||
* before.
|
||||
*/
|
||||
void view_execute_criteria(struct sway_view *view);
|
||||
void view_execute_criteria(struct sway_view *view, const char* trigger);
|
||||
|
||||
/**
|
||||
* Returns true if there's a possibility the view may be rendered on screen.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue