Jump to contentJump to page navigation: previous page [access key p]/next page [access key n]
documentation.suse.com / Documentação do SUSE Linux Enterprise Server / Administration Guide / System / Graphical User Interface
Applies to SUSE Linux Enterprise Server 15 SP2

21 Graphical User Interface

SUSE Linux Enterprise Server includes the X.org server and the GNOME desktop. This chapter describes the configuration of the graphical user interface for all users.

21.1 X Window System

The X.org server is the de facto standard for implementing the X11 protocol. X is network-based, enabling applications started on one host to be displayed on another host connected over any kind of network (LAN or Internet).

Usually, the X Window System needs no configuration. The hardware is dynamically detected during X start-up. The use of xorg.conf is therefore deprecated. If you still need to specify custom options to change the way X behaves, you can still do so by modifying configuration files under /etc/X11/xorg.conf.d/.

Tip
Tip: IBM Z: Configuring the Graphical User Interface

IBM Z does not have any input or output devices supported by X.Org. Therefore, none of the configuration procedures described in this section apply. More relevant information for IBM Z can be found in Capítulo 5, Instalação no IBM Z e no LinuxONE.

Install the package xorg-docs to get more in-depth information about X11. man 5 xorg.conf tells you more about the format of the manual configuration (if needed). More information on the X11 development can be found on the project's home page at http://www.x.org.

Drivers are found in xf86-video-* packages, for example xf86-video-ati. Many of the drivers delivered with these packages are described in detail in the related manual page. For example, if you use the ati driver, find more information about this driver in man 4 ati.

Information about third-party drivers is available in /usr/share/doc/packages/<package_name>. For example, the documentation of x11-video-nvidiaG03 is available in /usr/share/doc/packages/x11-video-nvidiaG04 after the package was installed.

21.2 Installing and Configuring Fonts

Fonts in Linux can be categorized into two parts:

Outline or Vector Fonts

Contains a mathematical description as drawing instructions about the shape of a glyph. As such, each glyph can be scaled to arbitrary sizes without loss of quality. Before such a font (or glyph) can be used, the mathematical descriptions need to be transformed into a raster (grid). This process is called font rasterization. Font hinting (embedded inside the font) improves and optimizes the rendering result for a particular size. Rasterization and hinting is done with the FreeType library.

Common formats under Linux are PostScript Type 1 and Type 2, TrueType, and OpenType.

Bitmap or Raster Fonts

Consists of an array of pixels designed for a specific font size. Bitmap fonts are extremely fast and simple to render. However, compared to vector fonts, bitmap fonts cannot be scaled without losing quality. As such, these fonts are usually distributed in different sizes. These days, bitmap fonts are still used in the Linux console and sometimes in terminals.

Under Linux, Portable Compiled Format (PCF) or Glyph Bitmap Distribution Format (BDF) are the most common formats.

The appearance of these fonts can be influenced by two main aspects:

  • choosing a suitable font family,

  • rendering the font with an algorithm that achieves results comfortable for the receiver's eyes.

The last point is only relevant to vector fonts. Although the above two points are highly subjective, some defaults need to be created.

Linux font rendering systems consist of several libraries with different relations. The basic font rendering library is FreeType, which converts font glyphs of supported formats into optimized bitmap glyphs. The rendering process is controlled by an algorithm and its parameters (which may be subject to patent issues).

Every program or library which uses FreeType should consult the Fontconfig library. This library gathers font configuration from users and from the system. When a user amends their Fontconfig setting, this change will result in Fontconfig-aware applications.

More sophisticated OpenType shaping needed for scripts such as Arabic, Han or Phags-Pa and other higher level text processing is done using Harfbuzz or Pango.

21.2.1 Showing Installed Fonts

To get an overview about which fonts are installed on your system, ask the commands rpm or fc-list. Both will give you a good answer, but may return a different list depending on system and user configuration:

rpm

Invoke rpm to see which software packages containing fonts are installed on your system:

> rpm -qa '*fonts*'

Every font package should satisfy this expression. However, the command may return some false positives like fonts-config (which is neither a font nor does it contain fonts).

fc-list

Invoke fc-list to get an overview about what font families can be accessed, whether they are installed on the system or in your home:

> fc-list ':' family
Note
Note: Command fc-list

The command fc-list is a wrapper to the Fontconfig library. It is possible to query a lot of interesting information from Fontconfig—or, to be more precise, from its cache. See man 1 fc-list for more details.

21.2.2 Viewing Fonts

If you want to know what an installed font family looks like, either use the command ftview (package ft2demos) or visit http://fontinfo.opensuse.org/. For example, to display the FreeMono font in 14 point, use ftview like this:

> ftview 14 /usr/share/fonts/truetype/FreeMono.ttf

If you need further information, go to http://fontinfo.opensuse.org/ to find out which styles (regular, bold, italic, etc.) and languages are supported.

21.2.3 Querying Fonts

To query which font is used when a pattern is given, use the fc-match command.

For example, if your pattern contains an already installed font, fc-match returns the file name, font family, and the style:

> fc-match 'Liberation Serif'
LiberationSerif-Regular.ttf: "Liberation Serif" "Regular"

If the desired font does not exist on your system, Fontconfig's matching rules take place and try to find the most similar fonts available. This means, your request is substituted:

> fc-match 'Foo Family'
DejaVuSans.ttf: "DejaVu Sans" "Book"

Fontconfig supports aliases: a name is substituted with another family name. A typical example are the generic names such as sans-serif, serif, and monospace. These alias names can be substituted by real family names or even a preference list of family names:

> for font in serif sans mono; do fc-match "$font" ; done
DejaVuSerif.ttf: "DejaVu Serif" "Book"
DejaVuSans.ttf: "DejaVu Sans" "Book"
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"

The result may vary on your system, depending on which fonts are currently installed.

Note
Note: Similarity Rules according to Fontconfig

Fontconfig always returns a real family (if at least one is installed) according to the given request, as similar as possible. Similarity depends on Fontconfig's internal metrics and on the user's or administrator's Fontconfig settings.

21.2.4 Installing Fonts

To install a new font there are these major methods:

  1. Manually install the font files such as *.ttf or *.otf to a known font directory. If it needs to be system-wide, use the standard directory /usr/share/fonts. For installation in your home directory, use ~/.config/fonts.

    If you want to deviate from the standard directories, Fontconfig allows you to choose another one. Let Fontconfig know by using the <dir> element, see Section 21.2.5.2, “Diving into Fontconfig XML” for details.

  2. Install fonts using zypper. Lots of fonts are already available as a package, be it on your SUSE distribution or in the M17N:fonts repository. Add the repository to your list using the following command. For example, to add a repository for SLE 15:

    > sudo zypper ar
         https://download.opensuse.org/repositories/M17N:/fonts/SLE_15/

    To search for your FONT_FAMILY_NAME use this command:

    > zypper se 'FONT_FAMILY_NAME*fonts'

21.2.5 Configuring the Appearance of Fonts

Depending on the rendering medium, and font size, the result may be unsatisfactory. For example, an average monitor these days has a resolution of 100dpi which makes pixels too big and glyphs look clunky.

There are several algorithms available to deal with low resolutions, such as anti-aliasing (grayscale smoothing), hinting (fitting to the grid), or subpixel rendering (tripling resolution in one direction). These algorithms can also differ from one font format to another.

Via Fontconfig, it is possible to select a rendering algorithms for every font individually or for a set of fonts.

21.2.5.1 Configuring Fonts via sysconfig

SUSE Linux Enterprise Server comes with a sysconfig layer above Fontconfig. This is a good starting point for experimenting with font configuration. To change the default settings, edit the configuration file /etc/sysconfig/fonts-config. (or use the YaST sysconfig module). After you have edited the file, run fonts-config:

> sudo /usr/sbin/fonts-config

Restart the application to make the effect visible. Keep in mind the following issues:

  • A few applications do need not to be restarted. For example, Firefox re-reads Fontconfig configuration from time to time. Newly created or reloaded tabs get new font configurations later.

  • The fonts-config script is called automatically after every package installation or removal (if not, it is a bug of the font software package).

  • Every sysconfig variable can be temporarily overridden by the fonts-config command line option. See fonts-config --help for details.

There are several sysconfig variables which can be altered. See man 1 fonts-config or the help page of the YaST sysconfig module. The following variables are examples:

Usage of Rendering Algorithms

Consider FORCE_HINTSTYLE, FORCE_AUTOHINT, FORCE_BW, FORCE_BW_MONOSPACE, USE_EMBEDDED_BITMAPS and EMBEDDED_BITMAP_LANGAGES

Preference Lists of Generic Aliases

Use PREFER_SANS_FAMILIES, PREFER_SERIF_FAMILIES, PREFER_MONO_FAMILIES and SEARCH_METRIC_COMPATIBLE

The following list provides some configuration examples, sorted from the most readable fonts (more contrast) to most beautiful (more smoothed).

Bitmap Fonts

Prefer bitmap fonts via the PREFER_*_FAMILIES variables. Follow the example in the help section for these variables. Be aware that these fonts are rendered black and white, not smoothed and that bitmap fonts are available in several sizes only. Consider using

SEARCH_METRIC_COMPATIBLE="no"

to disable metric compatibility-driven family name substitutions.

Scalable Fonts Rendered Black and White

Scalable fonts rendered without antialiasing can result in a similar outcome to bitmap fonts, while maintaining font scalability. Use well hinted fonts like the Liberation families. Unfortunately, there is a lack of well hinted fonts though. Set the following variable to force this method:

FORCE_BW="yes"
Monospaced Fonts Rendered Black and White

Render monospaced fonts without antialiasing only, otherwise use default settings:

FORCE_BW_MONOSPACE="yes"
Default Settings

All fonts are rendered with antialiasing. Well hinted fonts will be rendered with the byte code interpreter (BCI) and the rest with autohinter (hintstyle=hintslight). Leave all relevant sysconfig variables to the default setting.

CFF Fonts

Use fonts in CFF format. They can be considered also more readable than the default TrueType fonts given the current improvements in FreeType2. Try them out by following the example of PREFER_*_FAMILIES. Possibly make them more dark and bold with:

SEARCH_METRIC_COMPATIBLE="no"

as they are rendered by hintstyle=hintslight by default. Also consider using:

SEARCH_METRIC_COMPATIBLE="no"
Autohinter Exclusively

Even for a well hinted font, use FreeType2's autohinter. That can lead to thicker, sometimes fuzzier letter shapes with lower contrast. Set the following variable to activate this:

FORCE_AUTOHINTER="yes"

Use FORCE_HINTSTYLE to control the level of hinting.

21.2.5.2 Diving into Fontconfig XML

Fontconfig's configuration format is the eXtensible Markup Language (XML). These few examples are not a complete reference, but a brief overview. Details and other inspiration can be found in man 5 fonts-conf or in /etc/fonts/conf.d/.

The central Fontconfig configuration file is /etc/fonts/fonts.conf, which—along other work—includes the whole /etc/fonts/conf.d/ directory. To customize Fontconfig, there are two places where you can insert your changes:

Fontconfig Configuration Files
  1. System-wide changes.  Edit the file /etc/fonts/local.conf (by default, it contains an empty fontconfig element).

  2. User-specific changes.  Edit the file ~/.config/fontconfig/fonts.conf. Place Fontconfig configuration files in the ~/.config/fontconfig/conf.d/ directory.

User-specific changes overwrite any system-wide settings.

Note
Note: Deprecated User Configuration File

The file ~/.fonts.conf is marked as deprecated and should not be used anymore. Use ~/.config/fontconfig/fonts.conf instead.

Every configuration file needs to have a fontconfig element. As such, the minimal file looks like this:

<?xml version="1.0"?>
   <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
   <fontconfig>
   <!-- Insert your changes here -->
   </fontconfig>

If the default directories are not enough, insert the dir element with the respective directory:

<dir>/usr/share/fonts2</dir>

Fontconfig searches recursively for fonts.

Font-rendering algorithms can be chosen with following Fontconfig snippet (see Example 21.1, “Specifying Rendering Algorithms”):

Example 21.1: Specifying Rendering Algorithms
<match target="font">
 <test name="family">
  <string>FAMILY_NAME</string>
 </test>
 <edit name="antialias" mode="assign">
  <bool>true</bool>
 </edit>
 <edit name="hinting" mode="assign">
  <bool>true</bool>
 </edit>
 <edit name="autohint" mode="assign">
  <bool>false</bool>
 </edit>
 <edit name="hintstyle" mode="assign">
  <const>hintfull</const>
 </edit>
</match>

Various properties of fonts can be tested. For example, the <test> element can test for the font family (as shown in the example), size interval, spacing, font format, and others. When abandoning <test> completely, all <edit> elements will be applied to every font (global change).

Example 21.2: Aliases and Family Name Substitutions
Rule 1
<alias>
 <family>Alegreya SC</family>
 <default>
  <family>serif</family>
 </default>
</alias>
Rule 2
<alias>
 <family>serif</family>
 <prefer>
  <family>Droid Serif</family>
 </prefer>
</alias>
Rule 3
<alias>
 <family>serif</family>
 <accept>
  <family>STIXGeneral</family>
 </accept>
</alias>

The rules from Example 21.2, “Aliases and Family Name Substitutions” create a prioritized family list (PFL). Depending on the element, different actions are performed:

<default> from Rule 1

This rule adds a serif family name at the end of the PFL.

<prefer> from Rule 2

This rule adds Droid Serif just before the first occurrence of serif in the PFL, whenever Alegreya SC is in PFL.

<accept> from Rule 3

This rule adds a STIXGeneral family name just after the first occurrence of the serif family name in the PFL.

Putting this together, when snippets occur in the order Rule 1 - Rule 2 - Rule 3 and the user requests Alegreya SC, then the PFL is created as depicted in Table 21.1, “Generating PFL from Fontconfig rules”.

Table 21.1: Generating PFL from Fontconfig rules

Order

Current PFL

Request

Alegreya SC

Rule 1

Alegreya SC, serif

Rule 2

Alegreya SC, Droid Serif, serif

Rule 3

Alegreya SC, Droid Serif, serif, STIXGeneral

In Fontconfig's metrics, the family name has the highest priority over other patterns, like style, size, etc. Fontconfig checks which family is currently installed on the system. If Alegreya SC is installed, then Fontconfig returns it. If not, it asks for Droid Serif, etc.

Be careful. When the order of Fontconfig snippets is changed, Fontconfig can return different results, as depicted in Table 21.2, “Results from Generating PFL from Fontconfig Rules with Changed Order”.

Table 21.2: Results from Generating PFL from Fontconfig Rules with Changed Order

Order

Current PFL

Note

Request

Alegreya SC

Same request performed.

Rule 2

Alegreya SC

serif not in PFL, nothing is substituted

Rule 3

Alegreya SC

serif not in PFL, nothing is substituted

Rule 1

Alegreya SC, serif

Alegreya SC present in PFL, substitution is performed

Note
Note: Implication

Think of the <default> alias as a classification or inclusion of this group (if not installed). As the example shows, <default> should always precede the <prefer> and <accept> aliases of that group.

<default> classification is not limited to the generic aliases serif, sans-serif and monospace. See /usr/share/fontconfig/conf.avail/30-metric-aliases.conf for a complex example.

The following Fontconfig snippet in Example 21.3, “Aliases and Family Name Substitutions” creates a serif group. Every family in this group could substitute others when a former font is not installed.

Example 21.3: Aliases and Family Name Substitutions
<alias>
 <family>Alegreya SC</family>
 <default>
  <family>serif</family>
 </default>
</alias>
<alias>
 <family>Droid Serif</family>
 <default>
  <family>serif</family>
 </default>
</alias>
<alias>
 <family>STIXGeneral</family>
 <default>
  <family>serif</family>
 </default>
</alias>
<alias>
 <family>serif</family>
 <accept>
  <family>Droid Serif</family>
  <family>STIXGeneral</family>
  <family>Alegreya SC</family>
 </accept>
</alias>

Priority is given by the order in the <accept> alias. Similarly, stronger <prefer> aliases can be used.

Example 21.2, “Aliases and Family Name Substitutions” is expanded by Example 21.4, “Aliases and Family Names Substitutions”.

Example 21.4: Aliases and Family Names Substitutions
Rule 4
<alias>
 <family>serif</family>
 <accept>
  <family>Liberation Serif</family>
 </accept>
</alias>
Rule 5
<alias>
 <family>serif</family>
 <prefer>
  <family>DejaVu Serif</family>
 </prefer>
</alias>

The expanded configuration from Example 21.4, “Aliases and Family Names Substitutions” would lead to the following PFL evolution:

Table 21.3: Results from Generating PFL from Fontconfig Rules

Order

Current PFL

Request

Alegreya SC

Rule 1

Alegreya SC, serif

Rule 2

Alegreya SC, Droid Serif, serif

Rule 3

Alegreya SC, Droid Serif, serif, STIXGeneral

Rule 4

Alegreya SC, Droid Serif, serif, Liberation Serif, STIXGeneral

Rule 5

Alegreya SC, Droid Serif, DejaVu Serif, serif, Liberation Serif, STIXGeneral

Note
Note: Implications.
  • In case multiple <accept> declarations for the same generic name exist, the declaration that is parsed last wins. If possible, do not use <accept> after user (/etc/fonts/conf.d/*-user.conf) when creating a system-wide configuration.

  • In case multiple <prefer declarations for the same generic name exist, the declaration that is parsed last wins. If possible, do not use <prefer> before user in the system-wide configuration.

  • Every <prefer> declaration overwrites <accept> declarations for the same generic name. If the administrator wants to allow the user to use <accept> and not only <prefer>, the administrator should not use <prefer> in the system-wide configuration. On the other hand, as users mostly use <prefer>, this should not have any detrimental effect. We also see the use of <prefer> in system-wide configurations.

21.3 GNOME Configuration for Administrators

21.3.1 The dconf System

Configuration of the GNOME desktop is managed with dconf. It is a hierarchically structured database or registry that allows users to modify their personal settings, and system administrators to set default or mandatory values for all users. dconf replaces the gconf system of GNOME 2.

Use dconf-editor to view the dconf options with a graphical user interface. Use dconf to access and modify configuration options with the command line.

The GNOME Tweaks tool provides an easy-to-use user interface for additional configuration options beyond the normal GNOME configuration. The tool can be started from the GNOME application menu or from the command line with gnome-tweak-tool.

21.3.2 System-wide Configuration

Global dconf configuration parameters can be set in the /etc/dconf/db/ directory. This includes the configuration for GDM or locking certain configuration options for users.

Use the following procedure as an example to create a system-wide configuration:

  1. Create a new directory that ends with a .d in /etc/dconf/db/. This directory can contain an arbitrary amount of text files with configuration options. For this example, create the file /etc/dconf/db/network.d/00-proxy with the following content:

    # This is a comment
    [system/proxy/http]
    host='10.0.0.1'
    enabled=true
  2. Parse the new configuration directives into the dconf database format:

    > sudo dconf update
  3. Add the new network configuration database to the default user profile, by creating the file /etc/dconf/profile/user. Then add the following content:

    system-db:network

    The file /etc/dconf/profile/user is a GNOME default. Other profiles can be defined in the environment variable DCONF_PROFILE.

  4. Optional: To lock the proxy configuration for users, create the file /etc/dconf/db/network/locks/proxy. Then add a line to this file with the keys that may not be changed:

    /system/proxy/http/host
    /system/proxy/http/enabled

You can use the graphical dconf-editor to create a profile with one user and then use dconf dump / to list all configuration options. The configuration options can then be stored in a global profile.

A detailed description of the global configuration is available at https://wiki.gnome.org/Projects/dconf/SystemAdministrators.

21.3.3 More Information

For more information, see http://help.gnome.org/admin/.

21.4 Switching Between Intel and NVIDIA Optimus GPUs with SUSE Prime

SUSE Prime is a tool for switching between onboard Intel graphical processing units (GPUs), and NVIDIA GPUs equipped with NVIDIA's "switchable graphics" Optimus technology. Optimus provides a mechanism for easily switching between an onboard Intel GPU and a discrete NVIDIA GPU. This is designed for running a laptop in a power-saving mode, or at maximum performance: use the Intel GPU to save power, and the NVIDIA GPU for 3D applications.

SUSE Prime works only on systems running X11, not Wayland. If your system runs Wayland you may disable it and fall back to X11 (see Section 21.4.1, “Prerequisites”).

21.4.1 Prerequisites

There must not be a /etc/X11/xorg.conf file, and no configuration files with active "ServerLayout", "Device" or "Screen" sections in the /etc/X11/xorg.conf.d directory.

SUSE Prime only works with X11. Use the loginctl command to see if your system is using X11 or Wayland:

> loginctl
   SESSION        UID USER             SEAT             TTY             
         2       1000 tux             seat0               
> loginctl show-session 2|grep Type
Type=x11

If your system uses Wayland, disable it by editing /etc/gdm/custom.conf, and un-commenting WaylandEnable=false. Then reboot.

21.4.2 Installing and Using SUSE Prime

Your NVIDIA graphics card should already be installed and working. If it is not, see Section 21.4.3, “Installing NVIDIA Drivers”.

Install the suse-prime package:

> sudo zypper install suse-prime

To switch your GPU run one of the following commands, then log out and log back in:

> sudo prime-select intel
> sudo prime-select intel2
> sudo prime-select nvidia

Use the intel driver when it's the modesetting driver. intel2 is for systems that use the xf86-video-intel driver. You can get this information by installing and running inxi:

> inxi -G
Graphics: Device-1: Intel Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller
          Display Server: x11(X.org 1.20.1 ) drivers: modesetting (unloaded: fbdev, vesa)
          Resolution: 1920x1080@60.00hz
          OpenGL: renderer: Mesa DRI Intel Haswell Desktop version: 4.5 Mesa 18.2.8

Which GPU is currently active?

> sudo /usr/sbin/prime-select get-current
Driver configured: intel

21.4.3 Installing NVIDIA Drivers

If you need to identify your NVIDIA card so you know which driver to use, run the following command:

> /sbin/lspci | grep VGA

List the available driver packages:

> sudo zypper se nvidia

Then install the drivers for your NVIDIA graphics card:

> sudo zypper se packagename