[HOME] [BASH] [Window Managers]

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 must stay four hours sitting 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 with the big prize of christmas lottery?

At this time (I was nineteen) my companions and me thought that we were just losing fourteen months of our lives. Now, with half life's experience on my back, I realized that it was just one of the lot of arbitrary stupid things that society forces individuals 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 don't dare to find out to what extent really depend on all this stuff.

With the same assurance the young version of me added another 'life of luxury' to other's descriptions I know exactly what I would answer to the officer if I could go back to this instant of my life: "I would buy a little house in a quiet place, far from all towns, and I would refrain from squandering".

With Linux A Window Manager Is Enough

Between others you can use FVWM, Icewm or Fluxbox.

Fonts

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

So first of all, I will explain how I configure fonts. I set dpi to 96 but you may preffer 100 or other value depending on the size of your screen. Generally it is not necessary to set dpi in all three files (~/.fonts.conf, ~/.Xdefaults and ~/.xserverrc) but doing so you will be sure all apps are covered.


Create ~/.xserverrc and add dpi resolution:

$ echo 'exec /usr/bin/X11/X -br -dpi 96 -nolisten tcp' > ~/.xserverrc

Create ~/.fonts.conf:

<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
	<edit name="dpi" mode="assign">
		<double>96</double>
	</edit>
</match>
<match target="font" >
	<edit mode="assign" name="rgba" >
		<const>rgb</const>
	</edit>
</match>
<match target="font" >
	<edit mode="assign" name="hinting" >
		<bool>true</bool>
	</edit>
</match>
<match target="font" >
	<edit mode="assign" name="hintstyle" >
		<const>hintslight</const>
	</edit>
</match>
<match target="font" >
	<edit mode="assign" name="antialias" >
		<bool>true</bool>
	</edit>
</match>
<match target="font">
	<edit name="autohint" mode="assign">
		<bool>true</bool>
	</edit>
</match>
</fontconfig>

Finally 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 the 'exactly' same behavior in all apps; in some cases 'different' (or, more suitable said, 'complementary') key bindings avoid problems between two applications that must live together.

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

# ~/.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-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

# 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"

Let's Go

I cosider startx the best choice; X will run like a client of 'your' shell process and you will have control over it.

# ~/.xinitrc

# Background
xsetroot -solid gray40

# Your window manager
#fluxbox
#icewm
twm

An example of TWM config:

# ~/.twmrc -- Walter A. Iglesias

# General options
ButtonIndent 0
NoGrabServer
NoRaiseOnMove
NoRaiseOnResize
BorderWidth 2
DecorateTransients
ConstrainedMoveTime 0
RandomPlacement
TitlePadding 6
OpaqueMove
WarpUnmapped
NoStackMode
NoSaveUnders
RestartPreviousState
AutoRelativeResize
DontMoveOff
ShowIconManager
IconifyByUnmapping
UsePPosition "on"

# Adjust the following to your screen resolution.  Rest 56px to the
# hight if you wish maximizated windows don't cover icon manager
MaxWindowSize "1680x1050"
IconManagerGeometry "=1680x26+0-0" 8

# Fonts
TitleFont "-misc-fixed-medium-r-normal--18-*-100-100-c-90-iso10646-1"
ResizeFont "-misc-fixed-medium-r-normal--18-*-100-100-c-90-iso10646-1"
MenuFont "-misc-fixed-medium-r-normal--18-*-100-100-c-90-iso10646-1"
IconFont "-misc-fixed-medium-r-normal--18-*-100-100-c-90-iso10646-1"
IconManagerFont "-misc-fixed-medium-r-normal--18-*-100-100-c-90-iso10646-1"

# Colors
Color
{
	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 { "XClock" "xosview" "xbiff" "xload" "TWM Icon Manager" }

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

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 }

# Mouse click

Button1 = : root : f.menu "main"
Button3 = : root : f.menu "windowops"
Button2 = : root : f.menu "TwmWindows"

Button1 = : t|f : f.function "move-or-raiselower"
Button3 = : title : f.menu "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
NoDefaults
RightTitleButton ":dot" = f.iconify
RightTitleButton ":resize" = f.function "resize-or-fullzoom"
RightTitleButton ":xlogo" = f.delete

# Key bindings
# Add to this list windows that you want cicle with Alt-Tab
WindowRing {
	"root"
	"UXTerm"
	"XTerm"
	"Emacs"
	"Firefox"
	"MPlayer"
	"Inkscape"
	"Gimp"
	"GV"
	"XDvi"
	"Xpdf"
}

"Menu" =   	: all : f.warpto "UXTerm"
"Tab"  = m 	: all : f.warpring "next"    # Defined at WindowRing
"Tab"  = m | s 	: all : f.warpring "prev"
"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
"F2" = m    : all : !"/usr/bin/gmrun $amp;"
"u"  = mod4 : all : !"/usr/bin/uxterm &"
"n"  = mod4 : all : !"/usr/bin/firefox &"
"e"  = mod4 : all : !"/usr/local/bin/emacs &"
"m"  = mod4 : all : !"uxterm -T \"Mutt\" -e sh -c \"/usr/bin/mutt\" &"

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

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

	""                  f.nop
	"Exit"              f.menu "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

<= Previous



[HOME] [BASH] [Window Managers]