Add window type to If as well
This one required some extra helpers so is separate commit
This commit is contained in:
parent
1d1fe5e6cc
commit
0a7ff45e49
3 changed files with 29 additions and 13 deletions
|
@ -75,6 +75,7 @@ typedef struct {
|
|||
TypedMatch class;
|
||||
TypedMatch name;
|
||||
TypedMatch role;
|
||||
TypedMatch type;
|
||||
} Query;
|
||||
|
||||
typedef struct {
|
||||
|
@ -153,7 +154,7 @@ static void free_typed_match(TypedMatch *tm)
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean check_typed_match(TypedMatch *tm, gchar *s)
|
||||
static gboolean check_typed_match(TypedMatch *tm, const gchar *s)
|
||||
{
|
||||
switch (tm->type) {
|
||||
case MATCH_TYPE_PATTERN:
|
||||
|
@ -212,6 +213,9 @@ static void setup_query(Options* o, xmlNodePtr node, QueryTarget target) {
|
|||
if ((n = obt_xml_find_node(node, "role"))) {
|
||||
setup_typed_match(&q->role, n);
|
||||
}
|
||||
if ((n = obt_xml_find_node(node, "type"))) {
|
||||
setup_typed_match(&q->type, n);
|
||||
}
|
||||
if ((n = obt_xml_find_node(node, "monitor"))) {
|
||||
q->client_monitor = obt_xml_node_int(n);
|
||||
}
|
||||
|
@ -283,6 +287,7 @@ static void free_func(gpointer options)
|
|||
free_typed_match(&q->class);
|
||||
free_typed_match(&q->name);
|
||||
free_typed_match(&q->role);
|
||||
free_typed_match(&q->type);
|
||||
|
||||
g_slice_free(Query, q);
|
||||
}
|
||||
|
@ -398,6 +403,8 @@ static gboolean run_func_if(ObActionsData *data, gpointer options)
|
|||
is_true &= check_typed_match(&q->class, query_target->class);
|
||||
is_true &= check_typed_match(&q->name, query_target->name);
|
||||
is_true &= check_typed_match(&q->role, query_target->role);
|
||||
is_true &= check_typed_match(&q->type,
|
||||
client_type_to_string(query_target));
|
||||
|
||||
if (q->client_monitor)
|
||||
is_true &= client_monitor(query_target) == q->client_monitor - 1;
|
||||
|
|
|
@ -2458,20 +2458,10 @@ static void client_get_session_ids(ObClient *self)
|
|||
}
|
||||
}
|
||||
|
||||
/*! Save the properties used for app matching rules, as seen by Openbox when
|
||||
the window mapped, so that users can still access them later if the app
|
||||
changes them */
|
||||
static void client_save_app_rule_values(ObClient *self)
|
||||
const gchar *client_type_to_string(ObClient *self)
|
||||
{
|
||||
const gchar *type;
|
||||
|
||||
OBT_PROP_SETS(self->window, OB_APP_ROLE, self->role);
|
||||
OBT_PROP_SETS(self->window, OB_APP_NAME, self->name);
|
||||
OBT_PROP_SETS(self->window, OB_APP_CLASS, self->class);
|
||||
OBT_PROP_SETS(self->window, OB_APP_GROUP_NAME, self->group_name);
|
||||
OBT_PROP_SETS(self->window, OB_APP_GROUP_CLASS, self->group_class);
|
||||
OBT_PROP_SETS(self->window, OB_APP_TITLE, self->original_title);
|
||||
|
||||
switch (self->type) {
|
||||
case OB_CLIENT_TYPE_NORMAL:
|
||||
type = "normal"; break;
|
||||
|
@ -2490,7 +2480,23 @@ static void client_save_app_rule_values(ObClient *self)
|
|||
case OB_CLIENT_TYPE_DOCK:
|
||||
type = "dock"; break;
|
||||
}
|
||||
OBT_PROP_SETS(self->window, OB_APP_TYPE, type);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
/*! Save the properties used for app matching rules, as seen by Openbox when
|
||||
the window mapped, so that users can still access them later if the app
|
||||
changes them */
|
||||
static void client_save_app_rule_values(ObClient *self)
|
||||
{
|
||||
OBT_PROP_SETS(self->window, OB_APP_ROLE, self->role);
|
||||
OBT_PROP_SETS(self->window, OB_APP_NAME, self->name);
|
||||
OBT_PROP_SETS(self->window, OB_APP_CLASS, self->class);
|
||||
OBT_PROP_SETS(self->window, OB_APP_GROUP_NAME, self->group_name);
|
||||
OBT_PROP_SETS(self->window, OB_APP_GROUP_CLASS, self->group_class);
|
||||
OBT_PROP_SETS(self->window, OB_APP_TITLE, self->original_title);
|
||||
|
||||
OBT_PROP_SETS(self->window, OB_APP_TYPE, client_type_to_string(self));
|
||||
}
|
||||
|
||||
static void client_change_wm_state(ObClient *self)
|
||||
|
|
|
@ -645,6 +645,9 @@ void client_update_icons(ObClient *self);
|
|||
/*! Updates the window's icon geometry (where to iconify to/from) */
|
||||
void client_update_icon_geometry(ObClient *self);
|
||||
|
||||
/*! Helper function to convert the ->type member to string representation */
|
||||
const gchar *client_type_to_string(ObClient *self);
|
||||
|
||||
/*! Set up what decor should be shown on the window and what functions should
|
||||
be allowed (ObClient::decorations and ObClient::functions).
|
||||
This also updates the NET_WM_ALLOWED_ACTIONS hint.
|
||||
|
|
Loading…
Reference in a new issue