home | tech | misc | code | bookmarks (broken) | contact | README

X11 trouble shooting

cannot open display as another user

When trying to open a program as another user (in this case, I`m trying to execute gdmsetup as root), if you get an error like:

# gdmsetup

(gdmsetup:9178): Gtk-WARNING **: cannot open display:

Try to export DISPLAY=:0 as that user, and xhost + as the user that own the X session.

A reference that may help is here.

Wrong font size when porting to another system/distro

DPI (dots per inch) change among Unix systems and GNU/Linux distributions. There is no default configuration. Whenever you port your application to another system, it is a good idea to check if DPI match.

To change DPI in a Unix system, with Xorg, does that:

First, in your ~/.Xresources file (or wherever it be), insert the following content:

Xft.dpi: 85.0

Change 85.0 for the best DPI for you. Then, load the file into X resources database:

$ xrdb -load .Xresources

Now, you have to tell the driver about the new DPI you want to use:

$ xrandr --dpi 85


Not all drivers support changing it at runtime from the xrandr. You should be able to set it directly in your X server configuration file (like xorg.conf), though.

This two resources were really valuable for me:

Although using -X, cannot forward X11

There are many causes to this problem. You should be able to check what is causing this by checking ssh debug output, so connect with ssh -v -X. The -v option will enable debug output we need. Check if you see the following line:

debug1: Remote: No xauth program; cannot forward with spoofing.

If you see this, it means that your system probably lacks the xauth program. Install it.

xterm insists in printing strange character when I type Alt+key

Many applications use Meta key as a keyboard shortcut to perform some operations. In some computers that lack a Meta key, the Alt key is normally used as meta.

You might want to use Meta key in some text applications. In irssi, for instance, I use it in combination with other keys to change windows. The problem comes when pressing the Meta key prints a non-ASCII instead of sending the correct signals (ESC characters). Meta-Q, for instance, will print ñ. This is because xterm is not configured to send ESC when making a combination with the Meta key. To change that behaviour, according to this link, you can add the following like to your X resources file:

XTerm*metaSendsEscape: true