srcery-colors / srcery-terminal

Srcery theme terminal configurations
MIT License
197 stars 17 forks source link

fix Xresources syntax to work with other applications #164

Closed anarcat closed 2 years ago

anarcat commented 2 years ago

In i3, I was trying to use the i3wm.colorX pattern to access those resources, and that doesn't work because * and . are two different bindings. In other words, * is not a wildcard like you would expect in another language.

In the X(7) manual page1, it says:

When an application looks for the value of a resource, it specifies a complete path in the hierarchy, with both class and instance names. However, resource values are usually given with only partially specified names and classes, using pattern matching constructs. An asterisk (*) is a loose binding and is used to represent any number of intervening components, including none. A period (.) is a tight binding and is used to separate immediately adjacent components. A question mark (?) is used to match any single component name or class. A database entry cannot end in a loose binding; the final component (which cannot be "?") must be specified. The lookup algorithm searches the resource database for the entry that most closely matches (is most specific for) the full name and class being queried. When more than one database entry matches the full name and class, precedence rules are used to select just one.

Now that I re-read this (a third time), it seems that *. should work because * represents "any number of components, including none", but the fact is it actually doesn't. It's possible this is a bug in xcb-util-xrm, but I think it's safer to fix this by using the simpler approach instead.

I have confirmed the modified version works in both i3 and xterm, which is what I was looking for.

See https://github.com/i3/i3/discussions/5051 for a further discussion.

roosta commented 2 years ago

I've changed the template and regenerated the config, thanks for figuring this out!

anarcat commented 2 years ago

oh yeah the template of course, forgot about that part, thanks! :)