X11

Table of Contents

1 Misc

check the screen resolution:

xdpyinfo | grep -B 2 resolution

2 font

How I made the WenQuanYi Micro Hei ttf font (clx-truetype only recognizes ttf, not ttc):

  • input: ttc file
  • Tool: fontforge

Open ttc file, select one, generate font, choose truetype The validation failed, but doesn't matter

3 Xrandr

Multiple Display:

# Mirror display
sudo xrandr --output HDMI-2 --same-as eDP-1
sudo xrandr --output HDMI-2 --off

Rotate

xrandr --output HDMI-1 --rotate left

Chagne resolution

xrandr --output HDMI-1 --mode 1920x1080

4 Display Manager

Install xdm. It will use the file $HOME/.xsession, so

ln -s $HOME/.xinitrc $HOME/.xsession

5 Window Manager

Candidates:

  • ratpoison
  • dwm
  • stumpwm: written in common lisp
  • exwm: emacs X window manager

Noop:

  • i3: flavor VI, Noop!

5.1 ratpoison

This is actually a wonderful WM. To start:

aptitude install ratpoison

In .xinitrc:

exec ratpoison
  • C-t ? to show the help

actually C-t is the prefix of every command, C-g to abort.

  • C-t :: type command
  • C-t !: run shell command
  • C-t .: open menu
  • C-t c: open terminal

HOWEVER, this is pretty old, and it cause the screen to go brighter and darker back and force. Fortunately the stumpwm is very like this one, but

  1. actively maintained on github.
  2. written in common lisp

6 Theme

6.1 cursor

Install xcursor-themes:

aptitude install xcursor-themes
aptitude show xcursor-themes # here it will output the themes name

In .Xresources:

Xcursor.theme: redglass

6.2 color

X11 color names: /etc/X11/rgb.txt

7 Emacs As Window Manager

http://www.howardism.org/Technical/Emacs/new-window-manager.html

sudo aptitude install xinit
sudo aptitude install emacs

In .initrc:

exec emacs

In emacs configure:

(set-frame-parameter nil 'fullscreen 'fullboth)

When you need to run something, just M-x ! and call xterm.

7.1 A time sink

  (defun setup-windows ()
    "Organize a series of windows for ultimate distraction."
    (interactive)
    (delete-other-windows)

    ;; Start with the Stack Overflow interface
    (sx-tab-frontpage t nil)

    ;; Put IRC on the other side
    (split-window-horizontally)
    (other-window 1)
    (circe-connect-all)

    ;; My RSS Feed goes on top:
    (split-window-vertically)
    (elfeed)

    ;; And start up the Twitter interface above that:
    (other-window 2)
    (split-window-vertically)
    (twit)

    (window-configuration-to-register ?w))

8 Trouble shooting

8.1 xinit

On Debian, when I dist-upgrade Debian 8 Jessie to 9 Stretch, the startx stop working. I try install a Debian 9 from its own image, and still the same result. The error message says:

vesa cannot read int vect screen found but none leave a usable configuration xf86enableioports failed to set iopl for i/o

The trick is you need:

chomd u+s /usr/bin/xinit

8.2 Multi screen, stumpwm detect as one

Install xdpyinfo. It is used to detect the heads.

9 Nvidia Driver

I'm installing the driver for my GTX 1060. It is a brand new card, the nouveau driver simply does not work.

Install the kernel header:

linux-headers-`uname -r`

Make sure the /tmp has enough space.

After installation, use nvidia-xconfig will write /etc/X11/xorg.conf. The original one will be backed up (actually original one is empty).

But, I haven't been able to boot to login page using nvidia card…

10 Natural Scrolling

The old solution is to swap the pointer button "4" and "5", by xmodmap or xinput:

xmodmap -e "pointer = 1 2 3 4 5"
xinput --set-button-map 10 1 2 3 5 4

The 10 is the id, to find it out, run xinput without argument.

But this way is deprecated, as of chromium 49 and above, it does not work any more. So use the xinput way to set the property:

xinput set-prop 10 "libinput Natural Scrolling Enabled" 1

I'm using logitech G900 and the property might be different. It works!

Not sure if the xinput command should be run each time the system boots. That would be hard for specifying ID.

The detail is, you can do this:

xinput # show a list of devices
xinput list-props <ID> # list of properties
xinput set-prop <deviceID> <propID> <value>