diff options
| -rw-r--r-- | data/rc.xml | 7 | ||||
| -rw-r--r-- | data/rc.xsd | 15 | ||||
| -rw-r--r-- | openbox/client.c | 6 | ||||
| -rw-r--r-- | openbox/config.c | 28 | ||||
| -rw-r--r-- | openbox/config.h | 2 |
5 files changed, 51 insertions, 7 deletions
diff --git a/data/rc.xml b/data/rc.xml index 98daf274..ebe2f310 100644 --- a/data/rc.xml +++ b/data/rc.xml @@ -642,7 +642,9 @@ <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. @@ -651,6 +653,9 @@ # 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 diff --git a/data/rc.xsd b/data/rc.xsd index 47eeed12..de227ea1 100644 --- a/data/rc.xsd +++ b/data/rc.xsd @@ -189,10 +189,11 @@ <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"/> @@ -252,6 +253,18 @@ <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"> <!-- this is copied to maximization. Keep that in sync. --> <xsd:restriction base="xsd:string"> diff --git a/openbox/client.c b/openbox/client.c index 43a2f551..371eb087 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -844,13 +844,15 @@ static ObAppSettings *client_get_settings_state(ObClient *self) !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) { ob_debug("Window matching: %s\n", app->name); diff --git a/openbox/config.c b/openbox/config.c index e1954a79..c82e3b3a 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -101,6 +101,7 @@ GSList *config_per_app_settings; 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 @@ void config_app_settings_copy_non_defaults(const ObAppSettings *src, 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();; @@ -212,6 +215,25 @@ static void parse_per_app_settings(ObParseInst *inst, xmlDocPtr doc, 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); diff --git a/openbox/config.h b/openbox/config.h index 3fd1b879..62b92473 100644 --- a/openbox/config.h +++ b/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 @@ struct _ObAppSettings GPatternSpec *class; GPatternSpec *name; GPatternSpec *role; + ObClientType type; GravityPoint position; gboolean pos_given; |
