Saturday, November 23, 2013

fonts -- x11 core or xft?

In this wiki, and in this fellows reflection, we see possible advantages of xft over X11 core fonts. But most installations have a portion of both. So when to use one over the other, what commands are available to both, what is the easier or more reliable configuration path...and so on?

Friday, November 22, 2013

[solved] .xinitrc - include startup programs?

Many Linux users, are in a GUI environment from startup to shutdown. They are in a GUI GDM before they enter their Window Manager Desktop Environment.

Others login to runlevel 3 so we can view startup messages before moving into runlevel 5. When we're satisfied with boot messages, we use "$ startx". Startx of course initializes X via the local file "/home/[user]/.xinitrc. Its final line calls whatever windows manager we want to use. So, for example, the last line in .xinitrc might be "exec twm", for those who use twm. Users can also include any other programs prior to that last line, as long as they fork them to background ("&") so the script isn't waiting for that program to exit before the next line is executed. A simple .xinitrc could be the following:
$ cat .xinitrc
# ~/.xinitrc
# set editor to nano
export EDITOR=nano

# clipboard app
/usr/bin/clipit &

# volume app
/usr/bin/volwheel &

# Tom's Window Manager
exec twm

A potential problem occurs for this group of people using "runlevel3 + startx". Because .xinitrc runs through a list of whatever apps the user wants and then loads the windows manager, the actual initialization of X11 is happening at the same time these programs are being called. Sometimes there's a conflict.

solution

Desktop Environments and some Windows Managers (eg. Cinnamon) allow users to configure startup programs via some sort of client, typically called "startup applications" or some such, which the user configures for their next boot. More generically, the answer is probably a /etc/rc.local file to run at startup, which I cover in this post.

Either way, one definitely should keep their .xinitrc simple: have it load the windows manager without adding applications. Instead, find which other scripts are called when the window's manager loads. Icewm has a nice way of handling this. If one uses "exec icewm-session" in their .xinitrc, icewm checks for a script the user can create called ~/.icewm/startup. For example, I tried this script with good results...
$ cat .icewm/startup
#!/bin/bash
# chmod from 644 to 755 - must be executable to be read by icewm-session

sleep 4
synclient TouchPadOff=1
xgamma -gamma .7
volwheel &
sleep 1
clipit &
sleep 1
exit
Icewm loaded quickly, and then the other two programs appeared in taskbar a few seconds later, without conflicts.

In the case of twm, it appears one could do something similar by placing a script call in their ~/.twmrc file. I didn't have the available time to test such an option today. The point here is to avoid conflicts when light windows managers load. If we can let .xinitrc simply load the selected windows manager, we can create or modify scripts to load other programs or settings downstream from .xinitrc.