ICS 54 Klefstad X Window System Version 11 Introduction . `X Windows System` is a network-transparent window system . software can run on one machine and send graphics to another . `X servers` run on computers with bitmap displays . `X clients` can run on other machines with all interaction going through a single server . interactions include text and graphics input/output . X is a platform for building window based applications . X supports . overlapping hierarchical windows . text and graphics operations . monochrome and color displays Example X Applications . terminal emulator (xterm) . clocks (xclock, dclock, and oclock) . calculator (xcalc) . load monitor (xload) . dictionary (xwebster) . mail managing utilities (xmh and xbiff) . manual page browser (xman) . C++ debugger (xdbx) . various demos (xeyes, ico, muncher, puzzle, xgc, etc.) . and many more user programs Display Names . every X server has a display name of the form hostname:displaynumber.screennumber . `hostname` is the name of the machine connected to the display . `displaynumber` starts at 0 and increases for each display on a machine, most machines have only one display . `screennumber` starts at 0 and increases similar to displaynumber . xterm sets your DISPLAY environment variable automatically . if you log in to a remote machine, you must set the DISPLAY environment variable to the appropriate display name . eg login to bonnie from sun workstation clipperton bonnie% setenv DISPLAY clipperton.uci.edu:0.0 Access Control . xhost . allows you to add another host to list of those accepted . eg add Bonnie clipperton% xhost +bonnie.ics.uci.edu . eg remove Bonnie clipperton% xhost -bonnie.ics.uci.edu . ~/.Xauthority contains lists of default hosts Geometry Specifications . layout on physical screen is controlled by the user . most X programs allow you to specify the window size and location . positive x,y origin is upper left corner . format: WIDTHxHEIGHT+XOFF+YOFF . eg % some_x_application_in_upper_left -geometry 80x22+0+0 % some_x_application_in_lower_right -geometry 80x22-0-0 Font Names . `font` - a set of images for the character set . eg 12 point roman (pica), 10 point roman (elete) . `families` - a set of fonts based on a type face . eg roman, bold, italic, bold italic, oblique, bold oblique . `directories` - a set of font families of the same resolution . eg 75 dots per inch, 100 dots per inch, etc. . each font directory has a list that maps each font name to the name of the file containing the font . fonts are found by searching your `font path` . you can modify your font path with `xset` . `xlsfonts` lists all the fonts in your font path Keys . `keycodes` - the physical keys on the keyboard . `keysyms` - an abstraction for a key function . `modifier list` - a list of keys affecting meaning of keys . eg shift, control, mouse button . `keymap table` - specifies how keycodes are mapped into keysyms Resources . saved default value for program attributes . resource format: app_name*option: value . `xrdb` - allows you to manage the resource data base . eg xrdb -load $HOME/.Xdefaults . .Xresources - usually where you put resource definitions . ~/.Xdefaults contains the defaults for all applications . eg resource definition file Xbiff*Geometry: 60x60+938+79 Xterm*Font: 8x13 Xterm*BoldFont: 8x13bold Xterm*TtyModes: intr ^c erase ^? kill ^u Xload*BorderWidth: 0 Emacs*Geometry: 80x50 Emacs*Font: 8x13 Window Managers . a `window manager` controls the layout of windows on the screen . provides window functions . eg move, resize, iconify, destroy . `twm` - the standard window manager, called Tab Window Manager . there are others - `mwm`, `olwm` Twm window manager . Buttons: 1-5 . Function keys: 1-9 . Shifts: Shift, Meta, Control . Areas: root, window, title, iconmgr, all . Functions: f.function_name, eg f.menu, f.move . user defined functions . .twmrc file defines . preference parameter settings . function mappings . menus Example Twm Init File . .twmrc IconManagerGeometry "-0+0" IconManagerDontShow { "xclock" "xbiff" "xeyes" } NoTitle { "xclock" "xload" "xbiff" "xeyes" } IconFont "6x13" MenuFont "6x13" #Button = keys :context : function #----------------------------------------- Button1= : root : f.menu"button1" Button2= : root : f.menu"button2" Button3= : root : f.menu"button3" Button1= : title : f.raise Button2= : title : f.move Button3= : title : f.lower Button2= m : window : f.function "raise-and-focus" Button3= s : window : f.lower "F1"= : all : f.raise "F2"= : all : f.lower "F3"= : window : f.iconify . twmrc (continued) menu "button1" { "Window Ops" f.title "Move Window" f.move "Resize Window" f.resize "Raise Window" f.raise "Lower Window" f.lower "Destroy Window" f.destroy "Kill twm" f.quit } menu "button2" { "Utilities" f.title "xgone" !"xgone 'Gone for a while' &" "twm Windows" f.menu "TwmWindows" } menu "button3" { "Xterms" f.title "Bonnie" !"/usr/uci/rxterm bonnie &" "local" !"/usr/bin/X11/xterm &" } function "raise-and-focus" { f.raise f.focus } Terminal Emulator . a `terminal emulator` acts as a CRT terminal within one window . `xterm` is a terminal emulator for X . it emulates a DEC VT102 . xterm allows one to cut and paste text across xterms . Button1 (start select) Button3 (end select) Button 2 (paste) . resize may require resetting environment variable for terminal size . a `console` is a special xterm for system messages Starting X Windows . .xserverrc . shell script to start up servers . default is to call X . eg Xsun, (X is aliased to Xsun) . on a bare workstation . `xinit` - starts X on your workstation, but is very primitive . alias x "xinit >& /dev/null ; kbd_mode -a" . `xstart` - does initialization then runs xinit . on an xterminal, just login - it will run your .xinitrc . .xinitrc . initialization shell script for xinit or login to xterminal . be sure to run applications in the background! . when .xinitrc exits, your X session terminates! . default is xterm -geometry +1+1 -n login -display :0 . eg xrdb -load $home/.Xdefaults xhost +bonnie.ics.uci.edu xsetroot -solid gray xclock -g 50x50-0+0 -bw 0 & xload -g 50x50-50+0 -bw 0 & xterm -n console -sb -C -g 57x4-150+0 & xterm -g 80x24+0-0 & xterm -g 80x24-0-0 & twm Basic X Utilities . /usr/uci/xstart - starts X windows on your workstation . xinit(L) - X Window System initializer . Xsun(L) - Sun server for X Version 11 . twm(L) - Tab Window Manager for the X Window System . xrdb(L) - X server resource database utility . xhost(L) - server access control program for X . xplaces(L) - take snapshot of personal X window configuration . resize(L) - set TERMCAP and terminal settings to current window size . kbd_mode(L) - recover the Sun console keyboard Some more X Applications . a display manager (xdm) . access control programs (xauth and xhost) . user preference setting programs (xrdb, xset, xsetroot, and xmodmap) . a font displayer (xfd) . a bitmap editor (bitmap) . utilities for listing information about fonts, windows, and displays (xlsfonts, xfontsel, xlswins, xwininfo, xlsclients, xdpyinfo, and xprop) . a diagnostic for seeing what events are generated and when (xev) . screen image manipulation utilities (xwd, xwud, xpr, and xmag) . and many more user programs