let you match per-app settings based on the window type
Dana Jansens danakj@orodu.net
5 files changed,
51 insertions(+),
7 deletions(-)
M
data/rc.xml
→
data/rc.xml
@@ -642,7 +642,9 @@ # own rules, but without the comments of course.
<application name="first element of window's WM_CLASS property (see xprop)" class="second element of window's WM_CLASS property (see xprop)" - role="the window's WM_WINDOW_ROLE property (see xprop)"> + role="the window's WM_WINDOW_ROLE property (see xprop)" + type="the window's _NET_WM_WINDOW_TYPE (if unspecified, then + it is dialog for child windows)"> # the name or the class can be set, or both. this is used to match # windows when they appear. role can optionally be set as well, to # further restrict your matches.@@ -650,6 +652,9 @@
# the name, class, and role use simple wildcard matching such as those # used by a shell. you can use * to match any characters and ? to match # any single character. + + # the type is one of: normal, dialog, splash, utility, menu, toolbar, dock, + # or desktop # when multiple rules match a window, they will all be applied, in the # order that they appear in this list
M
data/rc.xsd
→
data/rc.xsd
@@ -189,10 +189,11 @@ <xsd:element minOccurs="0" name="skip_pager" type="ob:bool"/>
<xsd:element minOccurs="0" name="skip_taskbar" type="ob:bool"/> <xsd:element minOccurs="0" name="fullscreen" type="ob:bool"/> <xsd:element minOccurs="0" name="maximized" type="ob:maximization"/> + <xsd:attribute name="role" type="xsd:string"/> + <xsd:attribute name="type" type="ob:clienttype"/> <!-- at least one of these must be present --> <xsd:attribute name="name" type="xsd:string"/> <xsd:attribute name="class" type="xsd:string"/> - <xsd:attribute name="role" type="xsd:string"/> </xsd:complexType> <xsd:complexType name="applications"> <xsd:element minOccurs="0" maxOccurs="unbounded" name="application" type="ob:application"/>@@ -250,6 +251,18 @@ <xsd:enumeration value="Undecorate"/>
<xsd:enumeration value="Unfocus"/> <xsd:enumeration value="Unmaximize"/> <xsd:enumeration value="Unshade"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:simpleType name="clienttype"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="desktop"/> + <xsd:enumeration value="dock"/> + <xsd:enumeration value="toolbar"/> + <xsd:enumeration value="menu"/> + <xsd:enumeration value="splash"/> + <xsd:enumeration value="utility"/> + <xsd:enumeration value="dialog"/> + <xsd:enumeration value="normal"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="bool">
M
openbox/client.c
→
openbox/client.c
@@ -844,12 +844,14 @@ if (app->name &&
!g_pattern_match(app->name, strlen(self->name), self->name, NULL)) match = FALSE; else if (app->class && - !g_pattern_match(app->class, - strlen(self->class), self->class, NULL)) + !g_pattern_match(app->class, + strlen(self->class), self->class, NULL)) match = FALSE; else if (app->role && !g_pattern_match(app->role, strlen(self->role), self->role, NULL)) + match = FALSE; + else if ((signed)app->type >= 0 && app->type != self->type) match = FALSE; if (match) {
M
openbox/config.c
→
openbox/config.c
@@ -101,6 +101,7 @@
ObAppSettings* config_create_app_settings(void) { ObAppSettings *settings = g_new0(ObAppSettings, 1); + settings->type = -1; settings->decor = -1; settings->shade = -1; settings->monitor = -1;@@ -124,6 +125,7 @@ {
g_assert(src != NULL); g_assert(dst != NULL); + copy_if(type, -1); copy_if(decor, -1); copy_if(shade, -1); copy_if(focus, -1);@@ -193,15 +195,16 @@ static void parse_per_app_settings(ObParseInst *inst, xmlDocPtr doc,
xmlNodePtr node, gpointer data) { xmlNodePtr app = parse_find_node("application", node->children); - gchar *name = NULL, *class = NULL, *role = NULL; - gboolean name_set, class_set; + gchar *name = NULL, *class = NULL, *role = NULL, *type = NULL; + gboolean name_set, class_set, type_set; gboolean x_pos_given; while (app) { - name_set = class_set = x_pos_given = FALSE; + name_set = class_set = type_set = x_pos_given = FALSE; class_set = parse_attr_string("class", app, &class); name_set = parse_attr_string("name", app, &name); + type_set = parse_attr_string("type", app, &type); if (class_set || name_set) { xmlNodePtr n, c; ObAppSettings *settings = config_create_app_settings();;@@ -211,6 +214,25 @@ settings->name = g_pattern_spec_new(name);
if (class_set) settings->class = g_pattern_spec_new(class); + + if (type_set) { + if (!g_ascii_strcasecmp(type, "normal")) + settings->type = OB_CLIENT_TYPE_NORMAL; + else if (!g_ascii_strcasecmp(type, "dialog")) + settings->type = OB_CLIENT_TYPE_DIALOG; + else if (!g_ascii_strcasecmp(type, "splash")) + settings->type = OB_CLIENT_TYPE_SPLASH; + else if (!g_ascii_strcasecmp(type, "utility")) + settings->type = OB_CLIENT_TYPE_UTILITY; + else if (!g_ascii_strcasecmp(type, "menu")) + settings->type = OB_CLIENT_TYPE_MENU; + else if (!g_ascii_strcasecmp(type, "toolbar")) + settings->type = OB_CLIENT_TYPE_TOOLBAR; + else if (!g_ascii_strcasecmp(type, "dock")) + settings->type = OB_CLIENT_TYPE_DOCK; + else if (!g_ascii_strcasecmp(type, "desktop")) + settings->type = OB_CLIENT_TYPE_DESKTOP; + } if (parse_attr_string("role", app, &role)) settings->role = g_pattern_spec_new(role);
M
openbox/config.h
→
openbox/config.h
@@ -23,6 +23,7 @@
#include "misc.h" #include "stacking.h" #include "place.h" +#include "client.h" #include "geom.h" #include "moveresize.h" #include "render/render.h"@@ -38,6 +39,7 @@ {
GPatternSpec *class; GPatternSpec *name; GPatternSpec *role; + ObClientType type; GravityPoint position; gboolean pos_given;