mirror of
https://github.com/labwc/labwc.git
synced 2026-03-01 01:40:24 -05:00
window-rules: add ignoreFocusRequest property
This allows to reject focus requests from specific applications.
This commit is contained in:
parent
272222e3c9
commit
bb235337d8
6 changed files with 21 additions and 0 deletions
|
|
@ -482,6 +482,9 @@ situation.
|
||||||
*skipWindowSwitcher* removes window from the Window Switcher (alt-tab
|
*skipWindowSwitcher* removes window from the Window Switcher (alt-tab
|
||||||
on-screen-display)
|
on-screen-display)
|
||||||
|
|
||||||
|
*<windowRules><windowRule ignoreFocusRequest="">* [yes|no|default]
|
||||||
|
*ignoreFocusRequest* prevent window to activate itself.
|
||||||
|
|
||||||
## ENVIRONMENT VARIABLES
|
## ENVIRONMENT VARIABLES
|
||||||
|
|
||||||
*XCURSOR_THEME* and *XCURSOR_SIZE* are supported to set cursor theme
|
*XCURSOR_THEME* and *XCURSOR_SIZE* are supported to set cursor theme
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ struct window_rule {
|
||||||
enum property server_decoration;
|
enum property server_decoration;
|
||||||
enum property skip_taskbar;
|
enum property skip_taskbar;
|
||||||
enum property skip_window_switcher;
|
enum property skip_window_switcher;
|
||||||
|
enum property ignore_focus_request;
|
||||||
|
|
||||||
struct wl_list link; /* struct rcxml.window_rules */
|
struct wl_list link; /* struct rcxml.window_rules */
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,8 @@ fill_window_rule(char *nodename, char *content)
|
||||||
set_property(content, ¤t_window_rule->skip_taskbar);
|
set_property(content, ¤t_window_rule->skip_taskbar);
|
||||||
} else if (!strcasecmp(nodename, "skipWindowSwitcher")) {
|
} else if (!strcasecmp(nodename, "skipWindowSwitcher")) {
|
||||||
set_property(content, ¤t_window_rule->skip_window_switcher);
|
set_property(content, ¤t_window_rule->skip_window_switcher);
|
||||||
|
} else if (!strcasecmp(nodename, "ignoreFocusRequest")) {
|
||||||
|
set_property(content, ¤t_window_rule->ignore_focus_request);
|
||||||
|
|
||||||
/* Actions */
|
/* Actions */
|
||||||
} else if (!strcmp(nodename, "name.action")) {
|
} else if (!strcmp(nodename, "name.action")) {
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,10 @@ window_rules_get_property(struct view *view, const char *property)
|
||||||
&& !strcasecmp(property, "skipWindowSwitcher")) {
|
&& !strcasecmp(property, "skipWindowSwitcher")) {
|
||||||
return rule->skip_window_switcher;
|
return rule->skip_window_switcher;
|
||||||
}
|
}
|
||||||
|
if (rule->ignore_focus_request
|
||||||
|
&& !strcasecmp(property, "ignoreFocusRequest")) {
|
||||||
|
return rule->ignore_focus_request;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return LAB_PROP_UNSPECIFIED;
|
return LAB_PROP_UNSPECIFIED;
|
||||||
|
|
|
||||||
|
|
@ -590,6 +590,11 @@ xdg_activation_handle_request(struct wl_listener *listener, void *data)
|
||||||
* for the seat / serial being correct and then allow the request.
|
* for the seat / serial being correct and then allow the request.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (window_rules_get_property(view, "ignoreFocusRequest") == LAB_PROP_TRUE) {
|
||||||
|
wlr_log(WLR_INFO, "Ignoring focus request due to window rule configuration");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: This is the exact same code as used in foreign.c.
|
* TODO: This is the exact same code as used in foreign.c.
|
||||||
* Refactor it into a public helper function somewhere.
|
* Refactor it into a public helper function somewhere.
|
||||||
|
|
|
||||||
|
|
@ -285,6 +285,12 @@ handle_request_activate(struct wl_listener *listener, void *data)
|
||||||
struct xwayland_view *xwayland_view =
|
struct xwayland_view *xwayland_view =
|
||||||
wl_container_of(listener, xwayland_view, request_activate);
|
wl_container_of(listener, xwayland_view, request_activate);
|
||||||
struct view *view = &xwayland_view->base;
|
struct view *view = &xwayland_view->base;
|
||||||
|
|
||||||
|
if (window_rules_get_property(view, "ignoreFocusRequest") == LAB_PROP_TRUE) {
|
||||||
|
wlr_log(WLR_INFO, "Ignoring focus request due to window rule configuration");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
desktop_focus_and_activate_view(&view->server->seat, view);
|
desktop_focus_and_activate_view(&view->server->seat, view);
|
||||||
view_move_to_front(view);
|
view_move_to_front(view);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue