X resources

Last updated

In the X Window System, the X resources are parameters of computer programs such as the name of the font used in the buttons, the background color of menus, etc. They are used in conjunction with or as an alternative to command line parameters and configuration files. [1] [2]

Contents

Format

At the X protocol level, resources are strings that are stored in the server and have no special meaning. The syntax and meaning of these strings is given by client libraries and applications.

Every X resource specifies a parameter for a program or one of its components. A fully specified resource has the following format:

application.component.subcomponent.subcomponent.attribute: value

This resource specifies the value of attribute for the component named component.subcomponent.subcomponent of the program application. Resources are often used for specifying the parameters of widgets created by the application. Since these widgets are arranged in a tree, the sequence of component/subcomponent names is used to identify a widget by giving its path within the tree. The value of the resource is the value of an attribute for this widget, such as its background color, etc.

X resources are also used to specify parameters for the program that are not directly related to its widgets, using the same syntax.

X resources are designed to allow the same parameter to be specified for more than one program or component. This is realized by allowing wildcard characters in a resource specification. In particular, the ? character is used to match the application name or a single component. The * character is used to match any number of components. These two characters can be used anywhere but at the end of the resource name. In other words, an attribute cannot be replaced by a wildcard character.

While the resources can be loosely specified via the wildcard characters, queries for the value of a resource must specify that resource exactly. For example, a resource can specify that the background of every component of the xmail program must be red:

xmail*background: red

However, when a program (e.g., the xmail program itself, when it wants to find out which background color to use) accesses the resource database via Xlib functions, it can only request the value of a specific resource. Contrary to most databases, the stored data can be specified loosely (via wildcard characters), but the interrogation cannot. For example, a program can query for the value of xmail.main.background or of xmail.toc.buttons.background, but cannot use ? or * to check the background color of several components at once.

Resources can also be specified for classes of elements: for example, application.widget.widget.attribute: value can be generalized by replacing the application name with its class (e.g., Mail instead of xmh), each widget with its type (Pane, Button, etc.), and the attribute with its type.

Location and use

During X display server execution, the X resources are stored in two standard locations, depending on whether they apply to all screens or to a particular one:

  1. the RESOURCE_MANAGER property of the root window of screen 0
  2. the SCREEN_RESOURCES property of the root window of an arbitrary screen
X resources are accessible to all programs connected to the X display server, even if running on different computers. Xresources.png
X resources are accessible to all programs connected to the X display server, even if running on different computers.

X resources are stored in the server rather than in a configuration file to allow programs started from other computers to use them. Indeed, a program connecting to an X display server from another computer can access the resources via the X protocol. Using the old system of storing program parameters in the .Xdefaults file creates the need of copying this file to all other computers where a program can be started.

Resources are manipulated by the xrdb program. In particular, many X display server configurations run xrdb at start up, instructing it to read the resources from the .Xresources file in the user's home directory. From this point on, every other program finds the resources in the two standard locations. You can view the current resources from a console with xrdb -query.

Client libraries

Xlib contains a number of convenience functions for accessing the resources on the server and manipulating them locally. These functions are used both by xrdb and by every other program that needs these resources. Most of these functions manipulate a resource database, which is a local data structure representing a set of resource specifications. The Xlib functions for resource management are:

In particular, the function XrmParseCommand allow parsing the command line arguments, reading resources that are then added to a local resource database. This way, the resources can be read from the server and used as defaults that are overridden by command line arguments.

For the sake of efficiency, integers called quarks are defined to represent local strings. Quarks are similar to atoms, but they represent strings stored locally rather than on the server. A number of Xlib functions create an association between strings and quarks. Quarks can be used in place of component names when using one of the above functions; resource names therefore correspond to quark lists.

See also

Related Research Articles

The Lightweight Directory Access Protocol is an open, vendor-neutral, industry standard application protocol for accessing and maintaining distributed directory information services over an Internet Protocol (IP) network. Directory services play an important role in developing intranet and Internet applications by allowing the sharing of information about users, systems, networks, services, and applications throughout the network. As examples, directory services may provide any organized set of records, often with a hierarchical structure, such as a corporate email directory. Similarly, a telephone directory is a list of subscribers with an address and a phone number.

A Uniform Resource Identifier (URI) is a unique sequence of characters that identifies an abstract or physical resource, such as resources on a webpage, mail address, phone number, books, real-world objects such as people and places, concepts. URIs are used to identify anything described using the Resource Description Framework (RDF), for example, concepts that are part of an ontology defined using the Web Ontology Language (OWL), and people who are described using the Friend of a Friend vocabulary would each have an individual URI.

VBScript is a deprecated programming language for scripting on Microsoft Windows using Component Object Model (COM) based on classic Visual Basic and Active Scripting.

In computing, Microsoft's ActiveX Data Objects (ADO) comprises a set of Component Object Model (COM) objects for accessing data sources. A part of MDAC, it provides a middleware layer between programming languages and OLE DB. ADO allows a developer to write programs that access data without knowing how the database is implemented; developers must be aware of the database for connection only. No knowledge of SQL is required to access a database when using ADO, although one can use ADO to execute SQL commands directly.

A query string is a part of a uniform resource locator (URL) that assigns values to specified parameters. A query string commonly includes fields added to a base URL by a Web browser or other client application, for example as part of an HTML document, choosing the appearance of a page, or jumping to positions in multimedia content.

Code injection is the exploitation of a computer bug that is caused by processing invalid data. The injection is used by an attacker to introduce code into a vulnerable computer program and change the course of execution. The result of successful code injection can be disastrous, for example, by allowing computer viruses or computer worms to propagate.

<span class="mw-page-title-main">Windows Registry</span> Database for Microsoft Windows

The Windows Registry is a hierarchical database that stores low-level settings for the Microsoft Windows operating system and for applications that opt to use the registry. The kernel, device drivers, services, Security Accounts Manager, and user interfaces can all use the registry. The registry also allows access to counters for profiling system performance.

In computing, the X Window System is a network-transparent windowing system for bitmap displays. This article details the protocols and technical structure of X11.

<span class="mw-page-title-main">X Toolkit Intrinsics</span>

X Toolkit Intrinsics is a library that implements an API to facilitate the development of programs with a graphical user interface (GUI) for the X Window System. It can be used in the C language. Design took place late 1980s to early 1990s.

<span class="mw-page-title-main">Comparison of command shells</span>

A command shell is a command-line interface to interact with and manipulate a computer's operating system.

<span class="mw-page-title-main">Xlib</span> Client library for the X Window System

Xlib is an X Window System protocol client library written in the C programming language. It contains functions for interacting with an X server. These functions allow programmers to write programs without knowing the details of the X protocol.

The X Window System core protocol is the base protocol of the X Window System, which is a networked windowing system for bitmap displays used to build graphical user interfaces on Unix, Unix-like, and other operating systems. The X Window System is based on a client–server model: a single server controls the input/output hardware, such as the screen, the keyboard, and the mouse; all application programs act as clients, interacting with the user and with the other clients via the server. This interaction is regulated by the X Window System core protocol. Other protocols related to the X Window System exist, both built at the top of the X Window System core protocol or as separate protocols.

In computer science, the event loop is a programming construct or design pattern that waits for and dispatches events or messages in a program. The event loop works by making a request to some internal or external "event provider", then calls the relevant event handler. The event loop is also sometimes referred to as the message dispatcher, message loop, message pump, or run loop.

<span class="mw-page-title-main">Terminfo</span> Concept in computer programming

Terminfo is a library and database that enables programs to use display terminals in a device-independent manner. Mary Ann Horton implemented the first terminfo library in 1981–1982 as an improvement over termcap. The improvements include

The structure of the Perl programming language encompasses both the syntactical rules of the language and the general ways in which programs are organized. Perl's design philosophy is expressed in the commonly cited motto "there's more than one way to do it". As a multi-paradigm, dynamically typed language, Perl allows a great degree of flexibility in program design. Perl also encourages modularization; this has been attributed to the component-based design structure of its Unix roots, and is responsible for the size of the CPAN archive, a community-maintained repository of more than 100,000 modules.

PL/SQL is Oracle Corporation's procedural extension for SQL and the Oracle relational database. PL/SQL is available in Oracle Database, Times Ten in-memory database, and IBM Db2. Oracle Corporation usually extends PL/SQL functionality with each successive release of the Oracle Database.

<span class="mw-page-title-main">Yesod (web framework)</span>

Yesod is a web framework based on the programming language Haskell for productive development of type-safe, representational state transfer (REST) model based, high performance web applications, developed by Michael Snoyman, et al. It is free and open-source software released under an MIT License.

<span class="mw-page-title-main">Distributed Data Management Architecture</span> Open, published architecture for creating, managing and accessing data on a remote computer

Distributed Data Management Architecture (DDM) is IBM's open, published software architecture for creating, managing and accessing data on a remote computer. DDM was initially designed to support record-oriented files; it was extended to support hierarchical directories, stream-oriented files, queues, and system command processing; it was further extended to be the base of IBM's Distributed Relational Database Architecture (DRDA); and finally, it was extended to support data description and conversion. Defined in the period from 1980 to 1993, DDM specifies necessary components, messages, and protocols, all based on the principles of object-orientation. DDM is not, in itself, a piece of software; the implementation of DDM takes the form of client and server products. As an open architecture, products can implement subsets of DDM architecture and products can extend DDM to meet additional requirements. Taken together, DDM products implement a distributed file system.

A uniform resource locator (URL), colloquially known as an address on the Web, is a reference to a resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifier (URI), although many people use the two terms interchangeably. URLs occur most commonly to reference web pages (HTTP/HTTPS) but are also used for file transfer (FTP), email (mailto), database access (JDBC), and many other applications.

ASP.NET Web Forms is a web application framework and one of several programming models supported by the Microsoft ASP.NET technology. Web Forms applications can be written in any programming language which supports the Common Language Runtime, such as C# or Visual Basic. The main building blocks of Web Forms pages are server controls, which are reusable components responsible for rendering HTML markup and responding to events. A technique called view state is used to persist the state of server controls between normally stateless HTTP requests.

References

  1. "Setting X Resources: Overview docstore.mik.ua/orelly/unix3/upt/ch06_05.htm".
  2. "The X Resources".