{Customising jstools Applications
The applications in the jstools suite can be customised in several ways, including preferences panels, startup scripts, and X defaults.

This document describes the customisation mechanisms for version 4.0/4.0b of the jstools application suite.

Preferences
All supported jstools applications (and to some extend other applications that use the jstools libraries) recognise the preferences set through the Global Preferences panel (q.v.).  This is normally available on the application's leftmost menu; it is also accessible through the standalone jprefs application.  Most applications also have an application­specific preferences panel, which will also be available on the application's leftmost menu.  (The jedit editor has three levels of preferences; in addition to global and application­specific preferences, it supports additional preferences for various types of files.)

(Preferences are stored in files under your ~/.tk directory (the directory .tk under your home directory).  Global preferences are stored in the file ~/.tk/defaults.  Application­specific defaults for each application are stored in the file ~/.tk/app-defaults, where app is the name of the application.  You shouldn't need to edit these files by hand.)

Startup Scripts
Most jstools applications support an application­specific startup script in Tcl, called ~/.tk/apprc.tcl.  This script contains additional Tcl code that the application will execute when it starts up.  Exactly what it's appropriate to put in here varies from application to application, but in general you can redefine procedures used by the application to change their behaviour.  The documentation for each application that can be customised in this way will have more information.

In order to write application­specific startup scripts effectively, you'll need to know Tcl and Tk, and you may need to know something about the structure of the application.  The book Tcl and the Tk Toolkit by the author of Tcl, John Ousterhout, (New York: Addison­Wesley, 1994) is a good introduction to programming in Tcl, although you'll also need to refer to the manual pages.  You may also find that you can pick up enough by examining the jstools scripts themselves.

In addition, the jstools applications will read in the startup script ~/.tk/jstoolsrc.tcl on startup if it exists.  This isn't likely to be useful to most people, since you can only put things there that will work in any application.  However, you might be able to use this file to tie your application to a debugger, or set defaults differently (with Tk's option(n) command) depending on what kind of machine you were on or what time of day it was.

The jstools applications also support a special­purpose startup scripts ~/.tk/textbindings.tcl and ~/.tk/entrybindings.tcl.  These are intended to supplement the keyboard bindings used by the applications, so you can make minor changes to them.  Unfortunately, I haven't written documentation about how to do this yet.  (You can include ordinary Tcl bind commands, but that may break things like jedit's special interpretation of punctuation and the Return key, or other special features of the bindings libraries.  I hope to document this in a future version.)

Sample configuration files
If jstools was installed normally at your site, there will be a few sample configuration files in the directory samples in the jstools library directory (typically /usr/local/lib/jstools).

X Defaults
You can also change the general appearance of the jstools applications (and other Tk applications) using the X defaults mechanism.

On startup, all jstools applications read in X defaults from the file ~/.tk/jstools.ad.  Defaults in that file (which is in normal X resources format, for which see the manual page for X(1X11) or Xserver(1X11)) will override other X defaults you may have set through the normal X defaults mechanism.  After that, defaults are read in from the file ~/.tk/app.ad, where app is the name of the application; these defaults override defaults in ~/.tk/jstools.ad.

(At some time in the future, I hope to provide a graphical interface for editing the defaults in these files.)

For reference, here are the defaults I use for Tk widgets:

! defaults for Tk widgets:
!
Tk*Text*font:        -*-lucidatypewriter-medium-r-normal-*-*-100-*
Tk*Listbox*font:     -*-lucidatypewriter-medium-r-normal-*-*-100-*
Tk*Entry*font:       -*-lucidatypewriter-medium-r-normal-*-*-100-*
Tk*Button*font:      -*-lucida-medium-r-normal-sans-*-100-*
Tk*Checkbutton*font: -*-lucida-medium-r-normal-sans-*-100-*
Tk*Radiobutton*font: -*-lucida-medium-r-normal-sans-*-100-*
Tk*Menu*font:        -*-lucida-medium-r-normal-sans-*-100-*
Tk*Menubutton*font:  -*-lucida-medium-r-normal-sans-*-100-*
Tk*Label*font:       -*-lucida-medium-r-normal-sans-*-100-*
Tk*Message*font:     -*-lucida-medium-r-normal-sans-*-100-*
Tk*insertWidth:				1
Tk*background:				grey80
Tk*Text*background:			grey80
Tk*Entry*background:			grey80
Tk*Scale*sliderForeground:		grey80
Tk*Scale*activeForeground:		grey90
Tk*Scrollbar*background:		grey80
Tk*Scrollbar*foreground:		grey80
Tk*Scrollbar*activeForeground:		grey90
Tk*activeBackground:			grey90
Tk*selectBackground:			grey60
Tk*selectForeground:			black
Tk*disabledForeground:			grey50
Tk*selector:				black

##############################################################
# metawidget options:
#
option add *Rule.relief sunken widgetDefault
option add *Rule.width 2 widgetDefault
option add *Rule.height 2 widgetDefault
option add *Rule.borderWidth 1 widgetDefault
option add *Filler.relief flat widgetDefault
option add *Filler.width 10 widgetDefault
option add *Filler.height 10 widgetDefault
} {{{jdoc:xref:link {2.24 2.31 2.83 2.101 2.103 2.118 2.124 2.134 4.81 4.88 7.4 7.34 7.83 7.104 7.144 7.172 7.290 7.296 7.453 7.458 12.5 12.12}} {jdoc:xref:manpage {16.357 16.363 26.185 26.186 26.196 26.203}} {jdoc:anchor:anchorname {6.0 7.0 11.0 12.0 20.0 21.0 23.0 24.0}} {richtext:font:roman {2.0 2.24 2.31 4.81 4.88 6.0 7.0 7.14 7.21 7.87 7.94 7.290 7.296 7.453 7.458 9.44 9.49 9.75 9.78 9.150 9.164 9.241 9.259 9.267 9.270 11.0 12.0 12.5 12.12 12.88 12.103 14.185 14.207 14.446 14.453 16.17 16.24 16.70 16.89 16.357 16.363 17.0 18.0 18.4 18.11 18.72 18.94 18.99 18.122 18.350 18.354 18.396 18.401 18.450 18.456 20.0 21.0 21.3 21.10 21.112 21.119 21.127 21.134 21.164 21.186 23.0 24.0 24.50 24.57 26.16 26.23 26.70 26.86 26.185 26.186 26.196 26.203 26.348 26.360 26.368 26.371 26.440 26.456 32.0 58.0 59.0}} {richtext:font:italic {9.247 9.250 9.267 9.270 12.94 12.97 14.185 14.207 26.354 26.357 26.368 26.371}} {richtext:font:bold {2.24 2.31 4.81 4.88 7.14 7.21 7.87 7.94 9.44 9.49 9.75 9.78 9.150 9.164 9.241 9.247 9.250 9.259 12.5 12.12 12.88 12.94 12.97 12.103 14.446 14.453 16.17 16.24 16.70 16.89 17.0 18.0 18.4 18.11 18.72 18.94 18.99 18.122 18.450 18.456 21.3 21.10 21.112 21.119 21.127 21.134 21.164 21.186 24.50 24.57 26.16 26.23 26.70 26.86 26.348 26.354 26.357 26.360 26.440 26.456}} {richtext:font:typewriter {7.290 7.296 7.453 7.458 16.357 16.363 18.350 18.354 18.396 18.401 26.185 26.186 26.196 26.203 32.0 58.0 59.0 69.0}} {richtext:font:heading0 {1.0 2.0}} {richtext:font:heading1 {6.0 7.0 11.0 12.0 20.0 21.0 23.0 24.0}} {jdoc:link:#Preferences {2.83 2.101}} {jdoc:link:jstools.jdoc {2.24 2.31 4.81 4.88 12.5 12.12}} {jdoc:link:jstools.jdoc#Applications {7.4 7.34}} {jdoc:link:jslibraries.jdoc {7.83 7.104}} {jdoc:link:panels/prefs.jdoc {7.144 7.172}} {jdoc:link:jprefs.jdoc {7.290 7.296}} {jdoc:link:jedit.jdoc {7.453 7.458}} {jdoc:anchorname:Preferences {6.0 7.0}} {jdoc:anchorname:Startup_Scripts {11.0 12.0}} {jdoc:anchorname:X_Defaults {23.0 24.0}} {jdoc:link:#Startup_Scripts {2.103 2.118}} {jdoc:link:#X_Defaults {2.124 2.134}} {jdoc:anchorname:Sample_configuration_files {20.0 21.0}} {jdoc:manpage:Xserver {26.196 26.203}} {jdoc:manpage:X {26.185 26.186}} {jdoc:manpage:option {16.357 16.363}}} {{richptr 23.0} {abbrevstart 5.0} {matchend 12.419} {abbrevend 5.0} {insert 1.0} {anchor 1.0} {matchstart 12.408} {current 2.82}}}