Created at:

X11 tips

Changing keyboard layout at runtime

The setxkbmap command can change keyboard layout without restarting X:

    $ setxkbmap br abnt2 # To use the ABNT2 layout

X11 runtime sets

To change sets at runtime in X11, you can use a lot of tools. Among them, xset:

    $ xset dpms force off       # Turn off monitor
    $ xset dpms force on        # Turn on monitor, but it still gets
                                # blank. To make images appear, type
                                # the next command:
    $ xset s reset              # Reset monitor.

Discover what driver X is trying to use

Just use this command:

    $ grep -B2 'Module class: X.Org Video Driver' /var/log/Xorg.0.log

Got this tip from Debian Nvidia Graphics Drivers page

In GNU/Linux, it is better to use lshw instead:

    # lshw -c video

Linux: How can I find what video driver is in use on my system?

Enable X forwarding on Ubuntu 10.04 Lucid Lynx

By default, unencrypted X forwarding is disabled in Ubuntu GNU/Linux 10.04 Lucid Lynx. It seems that using ssh -X to allow encrypted forwarding works when using GNOME, but I had problems using it with another more basic windows manager compiled by hand (notion). I have any idea why it happened and I didn't investigate it further.


Well, it was enough to modify file in /etc/gdm/gdm.schemas and change the default value of the key security/DisallowTCP from true to false and restart gdm. When login, use the xhost command and the DISPLAY environment variable to make the forwarding.

Allow X Client Display through TCP on Lucid

Use two touchscreen monitors

Connecting one touchscreen monitor and make the mouse point to the right position when your finger touches that might be tricky. After installing the right driver and configuring xorg.conf correctly, it works.

What about two touchscreen monitors? Setting up dual-head support is easy in xorg.conf, but how to tell system that, when the first touchscreen is touched, it should point the mouse pointer on the first monitor and the second touchscreen should point the mouse pointer on the second monitor?

Fortunately things get simpler as the time goes on... Nowadays, at least on Ubuntu 10.04 LTS Lucid Lynx, input devices are associated with events devices in /dev.

So, to discover what touchscreen is associated with each device, xxd each /dev/event* and touch the touchscreen::

    # xxd /dev/event0

If you see data when you touch it, so that event device is associated with the touchscreen you just touched. Take a note about that.

Then, install the evtouch driver::

    # apt-get install xserver-xorg-input-evtouch

evtouch is the driver that recognizes /dev/event* information and sets the mouse pointer for you.

After that, setup the xorg.conf (see example below). Although that example is using two Screens, it might be possible to use only one.

Then, it is likely to be working. Adjust the MinX, MinY, MaxX and MaxY for your setup.


A reference on my quest to solve this problem:

Evtouch configuration

Typing º and ª using Compose

You can see all Compose keys (for the en_US layout) in /usr/X11R7/lib/X11/locale/en_US/Compose for the en_US layout in NetBSD 8. Paths for GNU/Linux and other operating systems may change.

So, in summary, to write "ª" or "º" one have to type:

<Compose> <caret> <underscore> <a> :º:<Compose> <caret> <underscore> <o>