aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sway/tree/view.h1
-rw-r--r--sway/criteria.c17
-rw-r--r--sway/desktop/xwayland.c17
3 files changed, 28 insertions, 7 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 382ab6b9..30d3e742 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -170,6 +170,7 @@ struct sway_xwayland_view {
170 struct wl_listener request_activate; 170 struct wl_listener request_activate;
171 struct wl_listener set_title; 171 struct wl_listener set_title;
172 struct wl_listener set_class; 172 struct wl_listener set_class;
173 struct wl_listener set_role;
173 struct wl_listener set_window_type; 174 struct wl_listener set_window_type;
174 struct wl_listener set_hints; 175 struct wl_listener set_hints;
175 struct wl_listener map; 176 struct wl_listener map;
diff --git a/sway/criteria.c b/sway/criteria.c
index acc70d1b..feca904a 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -160,7 +160,10 @@ static bool criteria_matches_view(struct criteria *criteria,
160 } 160 }
161 161
162 if (criteria->window_role) { 162 if (criteria->window_role) {
163 // TODO 163 const char *role = view_get_window_role(view);
164 if (!role || regex_cmp(role, criteria->window_role) != 0) {
165 return false;
166 }
164 } 167 }
165 168
166 if (criteria->window_type != ATOM_LAST) { 169 if (criteria->window_type != ATOM_LAST) {
@@ -368,7 +371,7 @@ static char *get_focused_prop(enum criteria_token token) {
368 value = view_get_shell(view); 371 value = view_get_shell(view);
369 break; 372 break;
370 case T_TITLE: 373 case T_TITLE:
371 value = view_get_class(view); 374 value = view_get_title(view);
372 break; 375 break;
373 case T_WORKSPACE: 376 case T_WORKSPACE:
374 { 377 {
@@ -388,21 +391,21 @@ static char *get_focused_prop(enum criteria_token token) {
388 snprintf(id_str, id_size, "%zu", id); 391 snprintf(id_str, id_size, "%zu", id);
389 value = id_str; 392 value = id_str;
390 break; 393 break;
391 case T_CON_MARK: // These do not support __focused__
392 case T_FLOATING:
393#ifdef HAVE_XWAYLAND 394#ifdef HAVE_XWAYLAND
394 case T_CLASS: 395 case T_CLASS:
395 value = view_get_class(view); 396 value = view_get_class(view);
396 break; 397 break;
397 case T_ID:
398 case T_INSTANCE: 398 case T_INSTANCE:
399 value = view_get_instance(view); 399 value = view_get_instance(view);
400 break; 400 break;
401 case T_WINDOW_ROLE: 401 case T_WINDOW_ROLE:
402 value = view_get_class(view); 402 value = view_get_window_role(view);
403 break; 403 break;
404 case T_WINDOW_TYPE: 404 case T_WINDOW_TYPE: // These do not support __focused__
405 case T_ID:
405#endif 406#endif
407 case T_CON_MARK:
408 case T_FLOATING:
406 case T_TILING: 409 case T_TILING:
407 case T_URGENT: 410 case T_URGENT:
408 case T_INVALID: 411 case T_INVALID:
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 10faf91d..94a30239 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -154,6 +154,8 @@ static const char *get_string_prop(struct sway_view *view, enum sway_view_prop p
154 return view->wlr_xwayland_surface->class; 154 return view->wlr_xwayland_surface->class;
155 case VIEW_PROP_INSTANCE: 155 case VIEW_PROP_INSTANCE:
156 return view->wlr_xwayland_surface->instance; 156 return view->wlr_xwayland_surface->instance;
157 case VIEW_PROP_WINDOW_ROLE:
158 return view->wlr_xwayland_surface->role;
157 default: 159 default:
158 return NULL; 160 return NULL;
159 } 161 }
@@ -340,6 +342,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
340 wl_list_remove(&xwayland_view->request_activate.link); 342 wl_list_remove(&xwayland_view->request_activate.link);
341 wl_list_remove(&xwayland_view->set_title.link); 343 wl_list_remove(&xwayland_view->set_title.link);
342 wl_list_remove(&xwayland_view->set_class.link); 344 wl_list_remove(&xwayland_view->set_class.link);
345 wl_list_remove(&xwayland_view->set_role.link);
343 wl_list_remove(&xwayland_view->set_window_type.link); 346 wl_list_remove(&xwayland_view->set_window_type.link);
344 wl_list_remove(&xwayland_view->set_hints.link); 347 wl_list_remove(&xwayland_view->set_hints.link);
345 wl_list_remove(&xwayland_view->map.link); 348 wl_list_remove(&xwayland_view->map.link);
@@ -500,6 +503,17 @@ static void handle_set_class(struct wl_listener *listener, void *data) {
500 view_execute_criteria(view); 503 view_execute_criteria(view);
501} 504}
502 505
506static void handle_set_role(struct wl_listener *listener, void *data) {
507 struct sway_xwayland_view *xwayland_view =
508 wl_container_of(listener, xwayland_view, set_role);
509 struct sway_view *view = &xwayland_view->view;
510 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
511 if (!xsurface->mapped) {
512 return;
513 }
514 view_execute_criteria(view);
515}
516
503static void handle_set_window_type(struct wl_listener *listener, void *data) { 517static void handle_set_window_type(struct wl_listener *listener, void *data) {
504 struct sway_xwayland_view *xwayland_view = 518 struct sway_xwayland_view *xwayland_view =
505 wl_container_of(listener, xwayland_view, set_window_type); 519 wl_container_of(listener, xwayland_view, set_window_type);
@@ -587,6 +601,9 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
587 wl_signal_add(&xsurface->events.set_class, &xwayland_view->set_class); 601 wl_signal_add(&xsurface->events.set_class, &xwayland_view->set_class);
588 xwayland_view->set_class.notify = handle_set_class; 602 xwayland_view->set_class.notify = handle_set_class;
589 603
604 wl_signal_add(&xsurface->events.set_role, &xwayland_view->set_role);
605 xwayland_view->set_role.notify = handle_set_role;
606
590 wl_signal_add(&xsurface->events.set_window_type, 607 wl_signal_add(&xsurface->events.set_window_type,
591 &xwayland_view->set_window_type); 608 &xwayland_view->set_window_type);
592 xwayland_view->set_window_type.notify = handle_set_window_type; 609 xwayland_view->set_window_type.notify = handle_set_window_type;