mirror of
https://github.com/swaywm/sway.git
synced 2026-04-22 06:46:27 -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
2704e07c49
commit
80f4fce972
8 changed files with 36 additions and 21 deletions
|
|
@ -36,6 +36,7 @@ struct criteria {
|
|||
struct pattern *app_id;
|
||||
struct pattern *con_mark;
|
||||
struct pattern *cli_label;
|
||||
char *trigger; // event that triggered this criteria match
|
||||
uint32_t con_id; // internal ID
|
||||
#if HAVE_XWAYLAND
|
||||
struct pattern *class;
|
||||
|
|
@ -73,11 +74,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
|
||||
|
|
|
|||
|
|
@ -355,7 +355,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