---------------------------------------------------------------------------- The Florida SunFlash Using .Xdefaults under OpenWindows SunFLASH Vol 23 #21 November 1990 ---------------------------------------------------------------------------- I have received a number of technical articles from Tony Brooks, a Sun engineer. Some articles were written by Tony and others he has collected from other engineers. I will be posting these articles to SunFlash over the next few weeks. I hope that you enjoy them and find them useful. If you have any comments on them, please send them to me and I'll give them to Tony. -johnj ---------------------------------------------------------------------------- Overview of the User Defaults An application should not hardcode all the options that are possible under X, such as colors and fonts. It should allow the user to specify the colors of all windows, the font to use, the display and screen to use, the initial size and position of the application, and a large number of other standard and application specific options. The problem is that there are too many of these options to be specified on the command line every time the application is invoked. So the developers of X designed a more efficient way for users to specify options. The user places his options in a file which can be read by "xrdb", which places those specified values in the file on the root window. The name of the file that is read is called ".Xdefaults". This file contains key/value pairs e.g.: -------------------------------------------------------- % vi ~adb/.Xdefaults OpenWindows.SelectDisplaysMenu: False OpenWindows.WindowColor: #ad9a98 OpenWindows.DragRightDistance: 5 OpenWindows.Palette: summer OpenWindows.IconLocation: bottom OpenWindows.Beep: always OpenWindows.SetInput: followmouse OpenWindows.ScrollbarPlacement: right OpenWindows.WorkspaceColor: #40bdff Scrollbar.JumpCursor: True Notice.JumpCursor: True -------------------------------------------------------- The key/value pair may apply only to a particular window within a particular application, to an entire application, to a certain class of applications such as editors, or all applications. Now if I wanted to change the default font of the desktop I would have to edit my .Xdefaults file and add the following: -------------------------------------------------------- % xlsfonts % vi ~adb/.Xdefaults font.name: times-bold-24 % xrdb ~adb/.Xdefaults -------------------------------------------------------- The first thing that I did to add the font was find the font that I wanted using "xlsfonts" which will list all the server fonts. I will have a seperate discussion on fonts. Then I edited the file and afterwards ran "xrdb" which is used to get or set the contents of the RESOURCE_MANAGER property on the root window of screen 0. You would normally run this program from your X startup file - take a look at your .xinitrc file in your home directory it should look something like this: -------------------------------------------------------- % vi ~adb/.xinitrc # .xinitrc - OpenWindows startup script. xrdb $HOME/.Xdefaults & # Load X11 resource database eval `svenv -env` # SunView binary compatibility olwm & # OpenLook Window Manager (sv_xv_sel_svc &) & # SunView <-> XView selections if [ -x $HOME/.openwin-init ]; then $HOME/.openwin-init # Custom OpenWindows tools else $OPENWINHOME/lib/openwin-init # Default OpenWindows tools fi wait -------------------------------------------------------- Now bring up another window from the rootmenu and you should get a window with a bigger font. I will also talk more on the different startup files i.e., .xinitrc, .openwin-init etc. Finally, I've included the predefined defaults that you can change in your .Xdefaults file. (XView Programming Manual, pg 321): Type | Name | Default | Legal Values --------------------------------------------------------------------------- string | window.scale | Medium | Small,Medium, Large, | | | Extra_Large string | font.name | NULL | fontname-size | | | boolean | window.mono.disable- | False | True, False | | | string | server.name | getenv(DIS- | hostnamedisplay | | PLAY) | | | | boolean | alarm.audible | True | True, False | | | boolean | alarm.visible | True | True, False | | | string | window.header | NULL | header string | | | integer | window.columns | 80 | ---- | | | integer | window.rows | 34 | ---- | | | integer | window.width | 80 columns | Greater than 0 | | | integer | window.height | 34 rows | Greater than 0 | | | integer | window.x | 0 | ---- | | | integer | window.y | 0 | ---- | | | boolean | window.iconic | False | True, False | | | integer | window.inheritcolor | 1 | | | | string | window.color.fore- | "0 0 0" | 3 RGB values, 0-255 | ground | | | | | string | window.color.back- | "255 255 255" | 3 RGB values, 0-255 | ground | | | | | string | icon.font.name | NULL | fontname-size | | | string | icon.pixmap | NULL | pixmap filename | | | string | icon.footer | NULL | footer string | | | integer | icon.x | 0 | ---- | | | integer | icon.y | 0 | ---- | | | integer | openWindows.dragRight-| 5 | ---- | Distance | | | | | boolean | notice.jumpCursor | True | True, False | | | integer | notice.beepCount | 1 | ---- | | | integer | OpenWindows.Multi- | 4 | 1 through 10 (in sec/10) | ClickTimeout | | | | | integer | scrollbar.repeatDelay | 500 | 0,999(msec delay interval) | | | integer | scrollbar.pageinterval| 100 | 0,999(msec delay interval) | | | integer | scrollbar.lineinterval| 1 | 0,999(msec delay interval) | | | integer | cmdtool.checkpoint- | 0 | 0, 0x77777777 | Frequency | | | | | integer | cmdtool.maxLogFile- | 0x77777777 | 0, 0x77777777 | Size | | | | | integer | text.checkpoint- | 0 | 0, 0x77777777 | | | boolean | text.enableScrollbar | True | True, False | | | integer | text.againLimit | 1 | 0,500 | | | boolean | text.autoindent | False | True, False | | | integer | text.autoScrollby | 1 | 0,100 | | | boolean | text.blinkcaret | True | True, False | | | boolean | text.confirmOverwrite | True | True, False | | | boolean | text.displayControl- | False | True, False | Chars | | | | | integer | text.undoLimit | 50 | 0,500 | | | string | text.insertMakesCaret-| If_auto_scroll| If_auto_scroll, Always | Visible | | | | | string | text.lineBreak | Wrap_word | Clip, Wrap_char, Wrap_word | | | integer | text.margin.bottom | 0 | -1, 50 | | | integer | mouse.multiclick.space| | | | | boolean | text.storeChangesFile | True | True,False | | | integer | text.margin.top | 2 | -1,50 | | | integer | text.margin.left | 8 | 0,2000 | | | integer | text.margin.right | 0 | 0,2000 | | | integer | text.tabWidt | 8 | 0,50 | | | string | text.extrasMenuFile- | .text_extra- | filename | name | _menu | | | (in /usr/lib) | | | | integer | text.maxDocumentSize | 20000 | 0,0x80000000 | | | boolean | text.retained | False | True, False | | | string | keyboard.arrowKeys | Yes | Yes, No | | | string | keyboard.leftHanded| | No | Yes, No | | | boolean | term.enableEdit | True | True, False | | | string | term.boldStyle | Invert | None, OFFSET_X, OFFSET_Y, | | | OFFSET_X_AND_Y, | | | OFFSET_X_AND_XY, | | | OFFSET_Y_AND_XY, | | | OFFSET_X_AND_Y_AND_XY, | | | OFFSET_XY, INVERT string | term.inverseStyle | Enable | ENABLE, DISABLED, | | | SAME_AS_BOLD | | | string | term.underlineStyle |Enable | ENABLE, DISABLED, | | | SAME_AS_BOLD --------------------------------------------------------------------------- ---------------------------------------------------------------------------- For fun, try commands: shelltool -scale Large & shelltool -font times-bold-24 & shelltool -help In your .Xdefaults, try: *.scale: Small The filemgr works out well with a Small scale ! -johnj ---------------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Sunflash is an electronic mail news service from Sun Microsystems, Ft. Lauderdale, Florida, USA. It is targeted at Sun Users and Customers. For additional information about SunFlash send mail to info-sunflash@sunvice.East.Sun.COM SunFlash is distributed via a hierarchy of aliases. Try to address change requests to the owner of the alias that you belong to. If you want to be added to the SunFlash alias, please contact the systems engineers at your local Sun office and/or send mail to sunflash-request@sunvice.East.Sun.COM. All prices, availability, and other statements relating to Sun or third party products are valid in the U.S. only. Please contact your local Sales Representative for details of pricing and product availability in your region. Descriptions of, or references to products or publications within SunFlash does not imply an endorsement of that product or publication by Sun Microsystems. Address comments to the SunFlash editor (John McLaughlin) at sun!sunvice!flash or flash@sunvice.East.Sun.COM. (305) 776-7770.