Advice about the scripts included in this site: try to understand what the script does and attempt to write your own version.  If you just cut and paste the next time you'll have to visit my stupid site again ;-).  Remember, it's not free software but to learn what makes you free.

Basic Configuration Tips For Linux Graphical Environment

Avoiding Dependencies

Unfortunately, in 1987 I had to do the compulsory military service (In Argentina, my country, it was abolished in 1994).  A pair of days before Christmas, four of us were on duty.  We had to stay four hours seated in a room like reinforcement in case of emergency(!?).

In the calmly of the night the young officer in charge asked us, one by one, the typical 'What would you do if you won the Christmas lottery jackpot?'

At that time (I was nineteen) my companions and me thought that we were just losing fourteen months of our lives.  Presently, with half life's experience on my back, I realize that it was just one among the lot of arbitrary stupid things society forces us to do.  Now I don't see a big difference between military service and school, neighborhood or family.  I've received worse abuses from teachers, neighbors, friends, relatives than from sergeants or captains.  Violence is spontaneous, natural, explicit.  Despotism is, the most of the times, subliminal, innocent.

And people support these abuses because they don't dare to find out to what extent they really depend on all that stuff.

With the same assurance the young version of me added one more "life of luxury" to the others' descriptions I know exactly what I would answer to the officer if I were able to go back to that instant of my life, "I would buy a little house in a quiet place, far from all towns, and refrain myself from squandering".

With Linux A Window Manager Is Enough

Between others you can use FVWM, Openbox or JWM.

Since we manage without desktop environments for idiots we don't need applications taking decisions for us, i.e. Firefox creating Desktop and Downloads directories without asking.  Run this:

# Remove stupid settings

sed -i "s#\$HOME/Desktop#$HOME#" ~/.config/user-dirs.dirs
sed -i "s#\$HOME/Documents#$HOME#" ~/.config/user-dirs.dirs
sed -i "s#\$HOME/Downloads#$HOME#" ~/.config/user-dirs.dirs
sed -i "s#\$HOME/Templates#$HOME#" ~/.config/user-dirs.dirs
sed -i "s#\$HOME/Music#$HOME#" ~/.config/user-dirs.dirs
sed -i "s#\$HOME/Public#$HOME#" ~/.config/user-dirs.dirs
sed -i "s#\$HOME/Videos#$HOME#" ~/.config/user-dirs.dirs
sed -i "s#\$HOME/Pictures#$HOME#" ~/.config/user-dirs.dirs



What's priority in graphical interfaces?  If you 'use' your machine surely your answer is a good fonts rendering.

First, let's avoid disrespectful and destructive fake innovation.  Even if it were logic (not the case), in the same way we don't decide to change in English "I was" for "I amed" when a system file has lived in some place during decades it should stay there.  Run as root:

# Preserve per user fonts.conf traditional place

sed -i '/<fontconfig>/,/<\/fontconfig>/d' /etc/fonts/conf.avail/50-user.conf
echo '<fontconfig>' >> 50-user.conf
echo -e '\t<include ignore_missing="yes">~/.fonts.conf</include>' >> \
echo '</fontconfig>' >> /etc/fonts/conf.avail/50-user.conf

Create ~/.fonts.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

<!-- Run 'fc-cache -rfv' to load this paths -->

<match target="font">
	<edit mode="assign" name="rgba"><const>rgb</const></edit>
	<edit mode="assign" name="hinting"><bool>true</bool></edit>
	<edit mode="assign" name="hintstyle"><const>hintslight</const></edit>
	<edit mode="assign" name="antialias"><bool>true</bool></edit>
	<edit name="autohint" mode="assign"><bool>true</bool></edit>

Add the following lines to your ~/.Xdefaults

Xft.antialias: 1
Xft.hinting: 1
Xft.hintstyle: hintslight
Xft.rgba: rgb
Xft.dpi: 96

Unified Keybindings

It doesn't care if emacs, vi or whatever while having for goal an unified set.  Taking in care that 'unified' doesn't mean 'exactly' the same behavior in all apps, in some cases 'different' (or, more suitable said, 'complementary') key bindings avoid problems between applications that have to live together.

Add to your ~/.bashrc

export GTK2_RC_FILES="$HOME/.gtkrc-2.0"

You can append this to your ~/.gtkrc-2.0.

# Generic Unix key bindings
binding "gtk-unix-text-entry"
	bind "<ctrl>u" { "delete-from-cursor" (paragraph-ends, -1) }
	bind "<ctrl>h" { "delete-from-cursor" (chars, -1) }
	bind "<ctrl>w" { "delete-from-cursor" (word-ends, -1) }
	bind "<ctrl>b" { "move-cursor" (paragraph-ends, -1, 0) }
	bind "<ctrl>e" { "move-cursor" (paragraph-ends, 1, 0) }
class "GtkEntry" binding "gtk-unix-text-entry"

# Vi key bindings (as far as possible)
binding "gtk-vi-tree-view"
	bind "j" { "move-cursor" (display-lines, 1) }
	bind "k" { "move-cursor" (display-lines, -1) }
	bind "l" { "move-cursor" (logical-positions, 1) }
	bind "h" { "move-cursor" (logical-positions, -1) }
	bind "slash" { "start-interactive-search" () }
binding "gtk-vi-menu"
	bind "j" { "move-current" (next) }
	bind "k" { "move-current" (prev) }
	bind "l" { "move-current" (child) }
	bind "h" { "move-current" (parent) }
class "GtkTreeView" binding "gtk-vi-tree-view"
class "GtkMenuShell" binding "gtk-vi-menu"

# Emacs key bindings
#binding "gtk-emacs-text-entry"
#	bind "<ctrl>b" { "move-cursor" (logical-positions, -1, 0) }
#	bind "<ctrl>f" { "move-cursor" (logical-positions, 1, 0) }
#	bind "<alt>b" { "move-cursor" (words, -1, 0) }
#	bind "<alt>f" { "move-cursor" (words, 1, 0) }
#	bind "<ctrl>a" { "move-cursor" (paragraph-ends, -1, 0) }
#	bind "<ctrl>e" { "move-cursor" (paragraph-ends, 1, 0) }
#	bind "<ctrl>d" { "delete-from-cursor" (chars, 1) }
#	bind "<ctrl>BackSpace"	{ "delete-from-cursor" (chars, -1) }
#	bind "<alt>d" { "delete-from-cursor" (word-ends, 1) }
#	bind "<alt>BackSpace" { "delete-from-cursor" (word-ends, -1) }
#	bind "<ctrl>k" { "delete-from-cursor" (paragraph-ends, 1) }
#	bind "<ctrl>space" { "entry.set_position" () }
#binding "gtk-emacs-text-view"
#	bind "<ctrl>p" { "move-cursor" (display-lines, -1, 0) }
#	bind "<ctrl>n" { "move-cursor" (display-lines, 1, 0) }
#	bind "<ctrl>space" { "set-anchor" () }
#binding "gtk-emacs-tree-view"
#	bind "<ctrl>s" { "start-interactive-search" () }
#	bind "<ctrl>f" { "move-cursor" (logical-positions, 1) }
#	bind "<ctrl>b" { "move-cursor" (logical-positions, -1) }
#binding "gtk-emacs-menu"
#	bind "<ctrl>n" { "move-current" (next) }
#	bind "<ctrl>p" { "move-current" (prev) }
#	bind "<ctrl>f" { "move-current" (child) }
#	bind "<ctrl>b" { "move-current" (parent) }
#class "GtkEntry" binding "gtk-emacs-text-entry"
#class "GtkTextView" binding "gtk-emacs-text-view"
#class "GtkTreeView" binding "gtk-emacs-tree-view"
#class "GtkMenuShell" binding "gtk-emacs-menu"

Comfortably navigating a PDF file:

# ~/.xpdfrc

bind ctrl-+ any zoomIn
bind ctrl-- any zoomOut

#continuousView yes

# Vi keybindings
bind h any scrollLeft(16)
bind l any scrollRight(16)
bind k any scrollUp(16)
bind j any scrollDown(16)
bind ctrl-y any scrollUp(16)
bind ctrl-e any scrollDown(16)
bind ctrl-u any scrollUpPrevPage(100)
bind ctrl-d any scrollDownNextPage(100)
bind ctrl-b any scrollUpPrevPage(800)
bind ctrl-f any scrollDownNextPage(800)
bind g any gotoPage(1)
bind G any gotoLastPage
bind / any find
bind f any toggleFullScreenMode

# Emacs keybindings
#bind ctrl-b any scrollLeft(16)
#bind ctrl-f any scrollRight(16)
#bind ctrl-p any scrollUp(16)
#bind ctrl-n any scrollDown(16)
#bind alt-v any scrollUpPrevPage(900)
#bind ctrl-v  any scrollDownNextPage(900)
#bind alt-< any gotoPage(1)
#bind alt-> any gotoLastPage
#bind ctrl-s any find

urlCommand "firefox %s"

# End of ~/.xpdfrc

Let's Go

Using xinit you can run the X server like a child of your user's shell process having control over it.  You'll have even more control using the xinit command instead of startx, since the former read exclusively your ~/.xinitrc customizations.

# ~/.xinitrc

# Background
xsetroot -solid rgb:5/5/5

# Start Apps
xterm -geometry +10+10 &

# Start Window Manager
#exec openbox
exec twm

An example of TWM config:

# ~/.twmrc -- Walter A. Iglesias

# General options
ButtonIndent 0
BorderWidth 2
ConstrainedMoveTime 0
TitlePadding 6
UsePPosition "on"

# Adjust the following to your screen resolution (Rest the necessary pixels to
# the hight to not cover Icon Manager)
MaxWindowSize "1024x714"
IconManagerGeometry "=1024x26+0-0" 6

# Fonts
TitleFont	"-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*"
ResizeFont	"-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*"
MenuFont	"-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*"
IconFont	"-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*"
IconManagerFont	"-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*"

# Colors
	BorderColor		"gray34"
	MenuBorderColor		"gray34"
	IconBorderColor		"gray34"

	DefaultBackground	"gray34"
	TitleBackground		"gray34"
	MenuBackground		"gray34"
	IconBackground		"gray34"
	IconManagerBackground	"gray34"
	MenuTitleBackground	"white"

	BorderTileBackground	"gray34"
	BorderTileForeground	"gray34"

	DefaultForeground	"white"
	TitleForeground		"white"
	MenuForeground		"white"
	IconForeground		"white"
	IconManagerForeground	"white"
	MenuTitleForeground	"gray34"

	IconManagerHighlight	"green"
	MenuShadowColor		"white"

# Don't draw title bar to these apps
NoTitle { "TWM Icon Manager" "XClock" "xosview" "xbiff" "xload" }

# Don't show these apps at icon manager
IconManagerDontShow { "XClock" "xosview" "xbiff" "xload" }

DefaultFunction f.nop

# Defining functions
MoveDelta 7
Function "move-or-raiselower"	{ f.move f.deltastop f.raiselower }
Function "move-or-iconify"	{ f.move f.deltastop f.iconify }
Function "resize-or-fullzoom"	{ f.resize f.deltastop f.fullzoom }
Function "deiconify-n-raise"	{ f.deiconify f.raise }
Function "forwiconmgr-n-raise"	{ f.forwiconmgr f.lower }
Function "backiconmgr-n-raise"	{ f.backiconmgr f.lower }
Function "warpto-n-cycle" {
	f.warpto "TWM Icon Manager"
	f.function "forwiconmgr-n-raise"
Function "warpto-n-backcycle" {
	f.warpto "TWM Icon Manager"
	f.function "backiconmgr-n-raise"

# Mouse click
Button1 = : root : "main"
Button3 = : root : "windowops"
Button2 = : root : "TwmWindows"

Button1 = : t|f : f.function "move-or-raiselower"
Button3 = : title : "windowops"

Button1 = m : w : f.function "move-or-raiselower"
Button3 = m : w : f.resize

Button1 = : iconmgr : f.function "deiconify-n-raise"
Button3 = : iconmgr : f.iconify

# Redmont title bar buttons
RightTitleButton ":dot" = f.iconify
RightTitleButton ":resize" = f.function "resize-or-fullzoom"
RightTitleButton ":xlogo" = f.delete

# Key bindings
"Tab"	= m	: all : f.function "warpto-n-cycle"
"Tab"	= m | s	: all : f.function "warpto-n-backcycle"
"F11"	= m 	: all : f.fullzoom
"F12"	= m 	: all : f.hzoom
"F10"	= m 	: all : f.zoom
"F8"	= m 	: all : f.iconify
"F4"	= m 	: all : f.delete

# programs
"u"	= mod4 : all : !"/usr/bin/urxvt &"
"n"	= mod4 : all : !"/usr/bin/firefox &"

# Menu
menu "main"
	"Menu"			f.title
	"XTerm (Win+u)"		! "xterm &"
	"Firefox (Win+n)"	! "firefox &"
	"Mutt (Win+m)"		! "xterm -T \"Mutt\" -e sh -c \"/usr/bin/mutt\" &"
	""			f.nop

	"Show Icon bar"		f.showiconmgr
	"Hide Icon bar"		f.hideiconmgr

	""			f.nop
	"Exit" "Quit-Verify"

menu "Icon bar"
	"Show"			f.showiconmgr
	"Hide"			f.hideiconmgr

menu "Quit-Verify"
	"Restart TWM"		f.restart
	"Exit"			f.quit

menu "windowops"
	"Window Ops"		f.title
	"Maximize (Alt+F11)"	f.fullzoom
	"H. Maximize (Alt+F12)"	f.hzoom
	"V. Maximize (Alt+F10)"	f.zoom
	"Iconify (Alt+F3)"	f.iconify
	"Resize"		f.resize
	"Move"			f.move
	"Raise"			f.raise
	"Lower"			f.lower
	"Identify"		f.identify
	""			f.nop
	"Focus"			f.focus
	"Unfocus"		f.unfocus
	""			f.nop
	"Close (Alt+F4)"	f.delete
	"Kill"			f.destroy

# End ~/.twmrc

Run Dialog Using BASH

You know what's installed in your machine, don't you?  What's the menu for?  Copy the following script to your ~/bin directory, change the execution bit and bind it to a Alt+F2 or whatever keystroke.  It's convenient to configure your window manager to keep "run" in the top layer.

# ~/bin/run - Run Dialog using XTerm and BASH
# Walter Alejandro Iglesias (Last modif. Sun Sep  7 21:15:41 CEST 2014)

# Customize
name=run	# Use this name to set the properties in your window manager
width=480	# Width in pixels

# If one instance is running exit
num=`ps axo ucmd | grep run | wc -l`
[ $num -gt 2 ] && exit 1

# Center
screen=`xrandr 2>/dev/null | grep '\*' | grep -o '^ *[0-9]*' | sed 's/ *//'`
vgeom=`echo "( $screen / 2 ) - ( $width / 2 )" | bc`

grep '! Run' ~/.Xdefaults >/dev/null || {
	echo ""						>> ~/.Xdefaults
	echo "! Run"					>> ~/.Xdefaults
	echo -n "run.VT100*translations: #override"	>> ~/.Xdefaults
	echo " <Key>Return: string(\"&\\nexit\\n\")"	>> ~/.Xdefaults
	echo "run.VT100*cursorUnderLine: on"		>> ~/.Xdefaults
	echo "run.VT100*cursorBlink: yes"		>> ~/.Xdefaults

if [ ! -e ~/.runrc ] ; then
	echo '#!/bin/sh'				>> ~/.runrc
	echo '# ~/.runrc'				>> ~/.runrc
	echo ''						>> ~/.runrc
	echo 'HISTFILE=~/.run_history'			>> ~/.runrc
	echo 'HISTCONTROL=ignorespace:erasedups'	>> ~/.runrc
	echo 'HISTIGNORE=exit'				>> ~/.runrc
	echo 'shopt -s histappend'			>> ~/.runrc
	echo 'bind "TAB: menu-complete"'		>> ~/.runrc
	echo 'bind "set show-all-if-ambiguous off"'	>> ~/.runrc
	echo 'PS1="> "'					>> ~/.runrc

xterm	-name $name		\
	-geom $geometry		\
	-fn $font		\
	-bg $background		\
	-fg $foreground		\
	$keysym			\
	-e bash --rcfile ~/.runrc

exit 0