Hacker News new | ask | show | jobs
by kiwidrew 1532 days ago
Actually the cross-platform Tk widgets use an internal "option database" which is essentially just Tcl-flavoured X11 resources. The typical usage is to just set the various options in the application's code, but it's also possible to merge in the display's existing X resources.

> At the end of the day X resources are just key-value pairs and the file allows for wildcards, includes, etc

If you squint a little bit, X resources are proto-CSS for the desktop: the clients have a tree of widgets (each widget having a class and a name) and query the resource database for style properties that apply to this tree; the resource database is composed of patterns ("selectors") and values for the various style properties; and applications have a default set of resources baked in which the user's resource database may override. Resource values are also typed (e.g. font, colour, screen position) and there is a rich syntax for specifying things like colours. It's all very elegant, but depends critically upon the X client (or its toolkit) actually bothering to implement this scheme. Qt never bothered and Gtk let its support slowly rot away.