X, Resources, Customisation kai Papades

Alexios Chouchoulas alexios at vennea.demon.co.uk
Sun Mar 2 01:32:28 EET 1997


  As requested, to mhnyma gia ta X resources. Dystyxws to etoimatzidiko
mhnyma to exw afhsei sto panepisthmio kai bariemai na to psaxnw, opote tha
aftosxediasw. :-)

  Syggnwmh prokatabolika gia to megalo mhnyma kai tyxon kotsanes.

  Kat'arxhn ti einai ta X resources: einai enas fobera isxyros tropos na
elegksoume kai na allaksoume thn emfanish kai th symperifora twn X
applications. Dinoun terasties dynatothtes gia customisation tou
look'n'feel.

  A, kai epeidh h leksh "widget" tha emfanistei poly syxna parakatw, ekshgw
oti widget einai opoiodhpote GUI object sta X. Px ta radio boxes kai ta push
button einai widgets, opws kai ta menou, ta labels, klp klp. Yparxoun orata
kai aorata widgets. To synolo olwn twn widgets onomazetai widget set, kai
kathe GUI apoteleitai apo to diko tou setaki (mazi me enan asorti window
manager), apo to original MIT Athena Widget set mexri to Motif kai to Athena
3D h 3D-XPM Widget Set.

  Ta resources einai kata bash pedia h metablhtes mesa sta widgets. Kathe
resource mporei na elegksei ena meros ths morfhs twn widgets. Dokimaste ena
aplo paradeigma (ta resource/value pairs ta bazoume sto ~/.Xdefaults h ta
taizoume sto stdin tou xrdb(1)):

Xterm*foreground: black
Xterm*background: green

  Me afto ton sxetika aplo tropo leme oti to background olwn twn widgets
olwn twn xterms mas tha einai mavro, enw to foreground tha einai prasino (h
allagh den einai emfanhs amesws, mono otan ksekinhsei ena neo xterm). H
syntaksh twn resource names einai kapws etsi:

[application] delimiter widget delim . . . delim resource

  Ta parakatw einai ola apodekta resource names:

Xterm.vt100.foreground
Xterm*foreground
Xterm.?.foreground
*foreground
StupidApp.has.a.very.deep.widget.tree.foreground

  Giati afto to xaos? Mia efarmogh apoteleitai apo ena dentro apo widgets
(afto epeidh merika widgets einai sxediasmena na periexoun alla widgets,
opws to Form h to Box widget tou Athena [-3D[-XPM]] widget set). Mporeite na
deite ta dentra twn perissoterwn efarmogwn me to programma editres(1) (pou
epitrepei na allaksoume ta resources diaforwn efarmogwn). Mporeite na breite
ta resource trees diaforwn efarmofwn eite sta man pages tous, eite me to
editres. Oi perissoteres Motif efarmoges (px Netscape) den milane to
prwtokolo tou editres, opote den mporoume na tis peiraksoume (xmmmmmm).

  As ypothesoume oti ena Xterm exei to ekshs widget tree (poly
aplopoihmeno):

  Xterm -- vt100 -- menu1
       |        |-- menu2
       |        \-- menu3
       \-- tek ---- menu1
                \-- menu2
                \-- menu3

  Otan loipon grafoume Xterm*foreground anaferomaste sta foregrounds OLWN
twn widgets pou einai mesa sto Xterm. Otan grafoume Xterm*vt100*foreground
anaferomaste sta foregrounds twn widgets pou einai katw apo to "vt100"
widget, dhladh sta menu1, menu2, menu3. An grapsoume Xterm*menu1*foreground
anaferomaste se ola ta menu1 widgets (kai sta dyo dhladh).

  To '*' anamesa sta onomata einai wildcard kai kanei match me opoiodhpote
arithmo opoiwndhpote widgets. Gi'afto to "Xterm*menu1.foreground" doulevei.
To allo delimiter einai h teleia (.). H teleia orizei resource names me
akribeia: to xterm.vt100.menu1.foreground milaei se ENA mono widget, enw an
bazame ena h perissotera * ekei mesa mporei na milousame kai se parapanw
widgets (an kai me toso aplo dentro, afto den isxyei).

  Epishs yparxei to format Xterm.?.menu1.foreground Afto kanei match se _1_
widget anamesa sto menu1 kai sto Xterm, opote an exoume menu1 widgets kai
allou, den tha ephreastoun (kai pali, to paradeigma einai toso aplo pou afto
den symbainei).

  H mesh antidrash einai oti afto einai POLY periploko. Den einai toso. Sto
katw katw einai poly efkolo na xrhsimopoihsoume to editres(1) pou deixnei
akribws thn leitourgia tou mhxanismou allazontas epitopou ta resources mias
efarmoghs.

  Alla ta bitsia synexizoun: kathe widget exei oxi ena alla DYO onomata: to
class name kai to instance name. Ola ta widgets idiou typou exoun idia class
names. Px, ta koumpia sto Athena Widget Set onomazontai Command (kefalaio
C -- ta class names einai panta me kefalaio prwto gramma. Ta instance names
exoun panta mikro prwto gramma). Giati afto einai xrhsimo? Me to
"Xterm*Command.font" anaferomaste sto font OLWN twn koumpiwn enos xterm kata
kathgoria. Afto dinei enan parapanw bathmo eleftherias sthn olh ypothesh.

  To "Xterm" parapanw einai class name. Class names exoun kai ta
applications (ta class names anaferontai sta man pages). Grafontas "Xterm"
anaferomaste se OLA ta xterms pou tha gennithoun sto mellon. To instance
name mias efarmoghs einai synithws idio me to class name, alla me ola ta
grammata mikra (tairiazei me to filename tou binary). Alla mporoume na to
allaksoume:

$ xterm -name allo_ena_xterm

  To class name tou neou xterm einai "Xterm". To instance name einai
"allo_ena_xterm". Etsi mporoume na exoume antigrafa ths idias efarmoghs
TAYTOXPONA, me teleiws diaforetikes symperifores. Fysika akoma kai idiou
typou widgets mesa sthn idia efarmogh mporei na einai teleiws diaforetika
metaksy tous. An paiksete me to editres, tha deite na emfanizontai ws
koumpia kai ta class names kai ta widget names.

  H olh xrhsimothta enos toso periplokou systhmatos einai oti mporoume na
orisoume genikes protimhseis opws "*background" (to background OLWN twn
widgets OLWN twn efarmogwn) h "*font" (to idio gia to font) kai meta na
kanoume override o,ti den mas aresei (px Xterm*background, Xterm*font). Afto
epitrepei kai aploustero administration se megala sites.

  Ws paradeigma, sto http://www.vennea.demon.co.uk/xcalc.gif mporeite na
breite ena screenshot pou deixnei thn idia efarmogh, to xcalc (calculator)
na trexei sto *IDIO* GUI (Athena Widget Set 3D-XPM kai fvwm2h, periergh
xakiasmenh ekdosh) alla me diaforetika resources.

  Gia osous bariountai na doun thn eikona (einai ligo katw apo 32k), to
aristero calculator einai customised: xrhsimopoiei prasino LCD font gia to
display, exei 3D koumpakia me metalliko texture, enw to background einai
stucco texture.

  To deksi calculator xrhsimopoiei thn default symperifora tou widget set,
pou moiazei ligo me tou macintosh: aspromavro look, aspro background, mavro
foreground, kampyla koumpia opws stous Mac, poly mikro font kai genikws
einai bareto. :-)  To mono endiaferon einai h diakosmhsh tou window manager
(ta plaisia klp) pou den allazoun me resources, etsi ki alliws).

  Afta. Elpizw na boithisa genika. An yparxoun apories, efxaristws tha
ksekatharisw oles tis blakeies pou eipa. :-)

  A.

Alexios Chouchoulas          '88    ,88'   ,88'     alexios at vennea.demon.co.uk
The Unpronouncable One      ,o88oooo88ooooo88oo,              axc at dcs.ed.ac.uk
==================================================================
For help on using this list (linux-greek-users), send a message to
"majordomo at argeas.argos.hol.gr" with one line of text: "help".
For any problem send e-mail to owner-linux-greek-users
==================================================================



More information about the Linux-greek-users mailing list