X86Free Window Manager'id ehk Aknahaldurid

XFree86 on Linuxitele sobiv programmide komplekt (üteldakse X - server), mis võimaldab graafilist terminali - X -terminali. Kui linuxi masin käivitada (PC), siis tavaliselt boodib ta ennast ülesse ja peatub mittegraafilises reshiimis ning jääb ootama kasutaja sisselogimist. (Saab ka kasutada xdm-i, et sisselogimine oleks graafilisest terminalist). Terminaliks nimetatakse seda töökohta kust serveriga (linuxi emamasinaga) suheldakse. Ühe masina puhul on sama masin nii serveriks kui ka terminaliks (mitmeks terminaliks - terminali ekraanide vahel saab valida Alt - F1, F2 .. abil). Kui teha üle võrgu kuhugi linuxi masinasse nt. telnet'i, siis on see aken kus te oma masinas parasjagu saate suhelda linuxiga tolle linuxi terminaliks.

Vaatleme nüüd praktilist olukorda kus on PC ja sinna on peale installeeritud Linux ja samuti XFree86.

Millised on võimalused X - Windows'i (st. X-terminali) väljanägemise sättimiseks?

Kõigepealt ütleb kohe ära, et ühes X-terminalidega tegelemiseks võimelisel masinal on kaks asja:

1. XFree86 server - toetab üldse graafilist interfacet - see käivitatakse kõigepealt
2. konkreetse akende kuju ja akende omadused (nt. milline nupp teeb akna ikooniks etc.) määrab millist aknahaldurit ja millise häälestusega kasutada.

Praktiliselt saab mittegraafilisest rezhiimist graafilisse käsuga startx (shell script) :

/usr/X11R6/bin/startx:

#!/bin/sh

# $XConsortium: startx.cpp,v 1.4 91/08/22 11:41:29 rws Exp $
# $XFree86: xc/programs/xinit/startx.cpp,v 3.0 1994/05/22 00:02:28 dawes Exp $
#
# This is just a sample implementation of a slightly less primitive
# interface than xinit.  It looks for user .xinitrc and .xserverrc
# files, then system xinitrc and xserverrc files, else lets xinit choose
# its default.  The system xinitrc should probably do things like check
# for .Xresources files and merge them in, startup up a window manager,
# and pop a clock and serveral xterms.
#
# Site administrators are STRONGLY urged to write nicer versions.
#
userclientrc=$HOME/.xinitrc
userserverrc=$HOME/.xserverrc
sysclientrc=/usr/X11R6/lib/X11/xinit/xinitrc
sysserverrc=/usr/X11R6/lib/X11/xinit/xserverrc
clientargs=""
serverargs=""

if [ -f $userclientrc ]; then
    clientargs=$userclientrc
else if [ -f $sysclientrc ]; then
    clientargs=$sysclientrc
fi
fi

if [ -f $userserverrc ]; then
    serverargs=$userserverrc
else if [ -f $sysserverrc ]; then
    serverargs=$sysserverrc
fi
fi

whoseargs="client"
while [ "x$1" != "x" ]; do
    case "$1" in
        /''*|\.*)       if [ "$whoseargs" = "client" ]; then
                    clientargs="$1"
                else
                    serverargs="$1"
                fi ;;
        --)     whoseargs="server" ;;
        *)      if [ "$whoseargs" = "client" ]; then
                    clientargs="$clientargs $1"
                else
                    serverargs="$serverargs $1"
                fi ;;
    esac
    shift
done

xinit $clientargs -- $serverargs
 

mis teeb kindlaks teatud oluliste failide asukohad ning lõpuks käivitab programmi xinit (binary).
xinit omakorda loeb läbi ja võtab arvesse konfiguratsioonifaili (rc - run command)
(kui ei leita ~/.xinitrc -d)
 

/var/X11R6/lib/xinit/xinitrc:
 
 

#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmaprrc
sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap
fi
# merge in defaults and keymaps

if [ -f $sysresources ]; then
whilxrdb -merge $sysresources
fi  case "$1" in
        /''*|\.*)       if [ "$whoseargs" = "client" ]; then
if [ -f $sysmodmap ]; thenargs="$1"
    xmodmap $sysmodmap
fi                  serverargs="$1"
                fi ;;
if [ -f $userresources ]; thenver" ;;
    xrdb -merge $userresourcesgs" = "client" ]; then
fi                  clientargs="$clientargs $1"
                else
if [ -f $usermodmap ]; thenrgs="$serverargs $1"
    xmodmap $usermodmap
fi  esac
    shift
# start some nice programs
xsetroot -cursor_name hand2
xsetroot -solid SteelBlue
fvwm

Siin ei oska ma muud öelda, kui seda, et viimased kolm rida on olulised, need määravad ara:

hand2 - hiire kursori kuju (muid vaata failist  /usr/X11R6/include/X11/cursorfont.h)
SteelBlue - tausta värvi
fvwm - aknahalduri mis käivitatkase (konf failid asuvad kataloogis /var/X11R6/lib/fvwm/, nt. system.fvwmrc).

Ja sellistel eeldustel, et X läheb tööle ja fvwm samuti vaatame paari asja mida saab fvwm-s muuta. See aknahaldur on üks vanemaid ja levinumaid. Siit vist järeldub ka et üks paremaid :)
 

Niisiis

FVWM - Feeble (Fabulus, ..) Virtual Windows Manager

Aknad
Aknahalduri roll on nagu eespool öeldud luua aknad ja nende omadused. Neis akendes hakkavad käivitatud programmid tööle. Aknaid saab suurendada, vähendada, asukohta muuta, teha ikooniks, üksteise peale asetada. 
Akende vahel saab tavaliselt liikuda Alt - Tab -iga. Muidugi ka hiirega. Hiirega kopeerimine toimub vasakut nuppu all hoides üle teksti libistades;siis tuleb kursor uude kohta viia ja  keskmise nupuga klõpsu teha (või kahenupuliste hiirte puhul vasakut paremat samaaegselt vajutada).

Desk
See on nö. virtuaalne desktop. Sellega seoses kasutatakse sõna "to pan". Kasutajale jäetakse mulje, et ta õiendab suuremal pinnal (nt. 3 x 3 monitori suurust), millest ta näeb tänu monitori väikesemõõdulisusele vaid mingit osa. Ringi saab tavaliselt liikuda kas hiirega Pageri vastavas sektsioonis klõpsides või Ctrl + Right Arrow, Left .... või Alt + Right Arrow, Left ....

Võimalik on ka teha mitu virtuaalset Desk'i. Ühest Deskist ei saa teise liikuda Deski sees liikumiseks mõeldud klahvikombinatsioonidega. Küll aga nt. Alt + 1, 2, 3 ... saab selliseks tegevuseks seada.

fvwm -il on levinud kaks versiooni, uuemat nimetatakse tavaliselt otse fvwm2 -ks.

Järgnevas kirjeldame vanemat :(
 
Selle, milline on X -terminali nägu määravad mitmed nö. rc failid - vaatame neist mõnda.

Mainitud system.fvwmrc

see fail koosneb mitmest sektsioonist:

Seal vist võiks jätta enamuse nagu vaikimisi on aga pöörame tähelepanu mõnele olulisele kohale:

Kuhugi päris ette võib panna rea:

Curson 1 2

see määrab kursori välimuse sõltuvalt kus ta on (akna äärel, all hoitud ..)

katke man fvwm:

       Cursor  cursor_num cursor_type
              This provides a very awkward way of changing cursor
              styles.  Cursor  num  tells  which  cursor  you are
              changing, and is a number between 0 and 12, as fol-
              lows

               0 POSITION     - used when initially placing windows
               1 TITLE        - used in a window title-bar
               2 DEFAULT      - used in windows that don't bother to set their cursor
               3 SYS          - used in one of the title-bar buttons
               4 MOVE         - used when moving or resizing windows.
               5 WAIT         - used during an EXEC builtin command.
               6 MENU         - used in a menus.
               7 SELECT       - used for various builtin commands such as iconify.
               8 DESTROY      - used for DESTROY and DELETE built-ins.
               9 TOP          - used in the top side-bar of a window
              10 RIGHT        - used in the right side-bar of a window
              11 BOTTOM       - used in the bottom side-bar of a window
              12 LEFT         - used in the left side-bar of a window.
              13 TOP_LEFT     - used in the top left corner
              14 TOP_RIGHT    - used in the top right corner
              15 BOTTOM_LEFT  - used in the bottom left corner
              16 BOTTOM_RIGHT - used in the bottom right corner

  The  cursor_type  argument  is a number which tells
              the cursor shape to use. The available numbers  can
              be  found in /usr/include/X11/cursorfont.h, and are
              currently even numbers between 0 and  152.  At  the
              current time, the following cursor types are avail-
              able.

              0   X_cursor                  2   arrow
              4   based_arrow_down          6   based_arrow_up
              8   boat                      10  bogosity
              12  bottom_left_corner        14  bottom_right_corner
              16  bottom_side               18  bottom_tee
              20  box_spiral                22  center_ptr
              24  circle                    26  clock
              28  coffee_mug                30  cross
              32  cross_reverse             34  crosshair
              36  diamond_cross             38  dot
              40  dotbox                    42  double_arrow
              44  draft_large               46  draft_small
              48  draped_box                50  exchange
              52  fleur                     54  gobbler
              56  gumby                     58  hand1
              60  hand2                     62  heart
              64  icon                      66  iron_cross
              68  left_ptr                  70  left_side
              72  left_tee                  74  leftbutton
              76  ll_angle                  78  lr_angle
              80  man                       82  middlebutton
              84  mouse                     86  pencil
              88  pirate                    90  plus
              92  question_arrow            94  right_ptr
              96  right_side                98  right_tee
              100 rightbutton               102 rtl_logo
              104 sailboat                  106 sb_down_arrow
              108 sb_h_double_arrow         110 sb_left_arrow
              112 sb_right_arrow            114 sb_up_arrow
              116 sb_v_double_arrow         118 shuttle
              120 sizing                    122 spider
              124 spraycan                  126 star
              128 target                    130 tcross
              132 top_left_arrow            134 top_left_corner
              136 top_right_corner          138 top_side
              140 top_tee                   142 trek
              144 ul_angle                  146 umbrella
              148 ur_angle                  150 watch
              152 xterm
See osa määrab, kuidas aken muutab aktiivseks (kas hiire kohale viimisel või klopsul, jt. asjad)

###########################################################################
# Set up the major operating modes
#
########################      FOCUS STUFF     ##############################
# Set windows to auto-raise after 750 milliseconds if you like it.
# Autoraise can sometimes obscure pop-up windows. Performance is now
# similar to olvwm's auto-raise feature.
#AutoRaise 750

# Normally, we'll be in focus-follows mouse mode, but uncomment this
# for mwm-style click-to-focus
ClickToFocus

########################      ICON STUFF     ##############################
# Auto Place Icons is a nice feature....
# This creates two icon boxes, one on the left side, then one on the
# bottom. Leaves room in the upper left for my clock and xbiff,
# room on the bottom for the Pager.
IconBox -150 90 -5 -140
IconBox 5 -140 -140 -5
#IconBox -70 1 -1 -140

# If you uncomment this, and make sure that the WindowList is bound to
# something, it works pretty much like an icon manager.
#SuppressIcons

# StubbornIcons makes icons de-iconify into their original position on the
# desktop, instead of on the current page.
#StubbornIcons

# With AutoPlacement, icons will normally place themselves underneath active
# windows. This option changes that.
#StubbornIconPlacement

# If you want ALL you icons to follow you around the desktop (Sticky), try
# this
#StickyIcons

Need määravad mööda deski liikumise aja akende liigutamise
 

########################      MISCELLANEOUS STUFF     #######################
# If you don't like the default 150 msec click delay for the complex functions
# change this and uncomment it.
#ClickTime 150

# OpaqueMove has a number (N) attached to it (default 5).
# if the window occupies less than N% of the screen,
# then opaque move is used. 0 <= N <= 100
#OpaqueMove 100

# flip by whole pages on the edge of the screen.
EdgeScroll 100 100

# A modest delay before flipping pages seems to be nice...
# I thresh in a 50 pixel Move-resistance too, just so people
# can try it out.
#EdgeResistance 250 50

# I like to use a large virtual screen and move from page to page with the
# pager.
## 0.4 sekundit peab hiirt vastu aart hoidma, et uus Page ette tuleks
EdgeResistance 400 0
 

Kuhu aknad satuvad kui neid programmid avavad:

########################      WINDOW PLACEMENT     #######################
# RandomPlacement prevents user interaction while placing windows:
## Paneb akna kohe maha, ei jä hiire külge tilbendama
RandomPlacement

# SmartPlacement makes new windows pop-up in blank regions of screen
# if possible, or falls back to random or interactive placement.
SmartPlacement

# With SmartPlacement, windows will normally place themselves over icons.
# Uncomment this to change that.
#StubbornPlacement

# NoPPosition instructs fvwm to ignore the PPosition field in window
# geometry hints. Emacs annoyingly sets PPosition to (0,0)!
#NoPPosition
 
 

Siin määratakse Deski suurus

###########################################################################
# Set up the virtual desktop and pager

#set the desk top size in units of physical screen size
DeskTopSize 3x3

# and the reduction scale used for the panner/pager
DeskTopScale 36

# Use the Fvwm Pager
##Paneb deski pagede raami asukohaga: x, y
#Pager 0 0
 

Kõige algul automaatselt käivitatavad programmid:
 

#############################################################################

# Stuff to do at start-up

Function "InitFunction"
#       Module  "I"     FvwmBanner
        Exec    "I"     xpmroot /root/taust.xpm &
#       Module  "I"     GoodStuff
##Paned Deskid, koos pealkirjadega, siin maaratakse deskide arv 0 .. n
        Module  "I"     FvwmPager 0 3
        Exec    "I"     exec xterm -geometry 80x30+90+0 &
#       Wait    "I"     FvwmPager
        Desk    "I"     0 3
#       Exec    "I"     exec netscape -geometry 800x600+10+10 &
#       Wait    "I"     netscape
        Wait    "I"     xterm
 
#       Desk    "I"     0 1
#       Exec    "I"     exec xterm -geometry 50x75+0+0 &
#       Wait    "I"     xterm
#       Desk    "I"     0 0
#       GotoPage "I"    3, 1
#       Exec    "I"     exec soffice &
#       Wait    "I"     soffice
#       Desk    "I"     0 2
#       Exec    "I"     exec netscape &
#       Wait    "I"     netscape
#       Desk    "I"     0 0

Määravad millised klahvikombinatsioonid ekraaniga nähtavat ala liigutavad:

# Now some keyboard shortcuts.

# Arrow Keys
# press arrow + control anywhere, and scroll by 1 page
Key Left        A       C       Scroll -100 0
Key Right       A       C       Scroll +100 +0
Key Up          A       C       Scroll +0   -100
Key Down        A       C       Scroll +0   +100

# press arrow + meta key, and scroll by 1/10 of a page
Key Left        A       M       Scroll -5 +0
Key Right       A       M       Scroll +5 +0
Key Up          A       M       Scroll +0   -5
Key Down        A       M       Scroll +0   +5

# press shift arrow + control anywhere, and move the pointer by 1% of a page
Key Left        A       SC      CursorMove -1 0
Key Right       A       SC      CursorMove +1 +0
Key Up          A       SC      CursorMove +0   -1
Key Down        A       SC      CursorMove +0   +1

# press shift arrow + meta key, and move the pointer by 1/10 of a page
Key Left        A       SM      CursorMove -10 +0
Key Right       A       SM      CursorMove +10 +0
Key Up          A       SM      CursorMove +0   -10
Key Down        A       SM      CursorMove +0   +10

# Keyboard accelerators
Key F1          A       M       Popup "Utilities"
Key F1          A       M       Popup "Utilities"
Key F2          A       M       Popup "Window Ops"
Key F3          A       M       Module "WindowList" FvwmWinList
Key F4          A       M       Iconify
Key F5          A       M       Move
Key F6          A       M       Resize
Key F7          A       M       CirculateUp
Key F8          A       M       CirculateDown

#Page Up/Dapge Down keys are used to scroll by one desktop page
# in any context, press page up/down + control
# in root context, just pressing page up/down is OK
#
# I prefer the non-wrapping scroll. These are for example purposes only
#Key Next       A       C       Scroll 100000 0
#Key Next       R       N       Scroll 100000 0
#Key Prior      A       C       Scroll -100000 0
#Key Prior      R       N       Scroll -100000 0
 
 

######################  Key and mouse bindings ##########################
# Format:
# Key   keyname context modifiers function
# Mouse button  context modifiers function
#       ------- ------- --------- --------
#                  |        |
#                  |        |- A = Any
#                  |        |- C = Control
#                  |        |- M = Meta (Esc or Alt)
#                  |        |- N = None
#                  |        |- S = Shift
#                  |
#                  |- 0-9 = Title bar buttons [1 3 5 7 9    0 8 6 4 2]
#                  |- A   = Any except buttons
#                  |- F   = Frame corners
#                  |- I   = Icon
#                  |- R   = Root window
#                  |- S   = Sides, top, bottom
#                  |- T   = Title bar
#                  |- W   = Application window

# Alt-tab for next window [like CDE]
Key Tab A       M       Next [*] Focus
Key Tab A       SM      Prev [*] Focus
Key Tab A       M       Next [*] Focus
Key Tab A       SM      Prev [*] Focus

# Alt-F4 to close current window [like CDE]
Key 5  A       M       Close

# Alt-1 through Alt-4 for changing desktops
Key 1   A       M       Desk 0 0
Key 2   A       M       Desk 0 1
Key 3   A       M       Desk 0 2
Key 4   A       M       Desk 0 3
 
 

Moodulid:

###################### GoodStuff button-bar ################################
# Colors
*GoodStuffFore Black
*GoodStuffBack #908090

# Font
*GoodStuffFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
# Geometry - really likes to pick its own size, but giving a position is OK
*GoodStuffGeometry -1-90

# Layout: specify rows or columns, not both
*GoodStuffRows 1

# Define the buttons to use.....
#*GoodStuff Kill    rbomb.xpm    Destroy

# xterm or rxvts on remote machines can be done like this
# Output re-direction is csh style, not sh style
# You will want to substitute your own hosts here!

#*GoodStuff Dopey   rterm.xpm   Exec "dopey" rsh dopey "exec xterm -T dopey -display $HOSTDISPLAY </dev/null >&/dev/null & "&
#*GoodStuff Grumpy  rterm.xpm   Exec "grumpy" rsh grumpy "exec xterm -T grumpy -display $HOSTDISPLAY </dev/null >&/dev/null & "&
#*GoodStuff Snoopy  rterm.xpm   Exec "snoopy" rsh snoopy "exec xterm -T snoopy -display $HOSTDISPLAY </dev/null >&/dev/null & "&
#*GoodStuff Xcalc   rcalc.xpm   Exec "Calculator" xcalc &
#*GoodStuff mail    mail2.xpm    Exec "xmh" xmh &
#*GoodStuff Exit rcalc.xmp Quit
#*GoodStuff Paging  clamp.xpm   TogglePage
*GoodStuff xclock  clock.xpm   Swallow "xclock" xclock -bg \#908090 -geometry -1500-1500 -padding 0 &
*Goodstuff xterm rcalc.xpm      Swallow "xterm" xterm &
*GoodStuff(4x1)  - whatever SwallowModule "FvwmPager" FvwmPager 0 3 
 

Deskide nimed

########################### Pager #########################################
##Siin maratakse Fvwm Pageri Desikide nimed!
*FvwmPagerBack #908090
*FvwmPagerFore #484048
*FvwmPagerFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
*FvwmPagerHilight #cab3ca
*FvwmPagerGeometry -1+0
*FvwmPagerLabel 0 Internet
*FvwmPagerLabel 1 System
*FvwmPagerLabel 2 Graafika
*FvwmPagerLabel 3 Tekst
*FvwmPagerSmallFont 5x8
 
 
 Tihti on mõne programmi F-klahvid blokeerunud kui programm töötab aknas. Work-around on kasutada Esc + <number>. Nt.

mc (Midnight Commander):

Esc +3 - view
Esc +4 - edit
Esc + 5 - copy