Lion icon Customization tips for Xdvi(k)

SourceForge.net Logo
Sourceforge Xdvik Project Page
Documentation

SourceForge Links

Most of the following customizations work by editing the file ~/.Xdefaults, which is read when starting up X. After making changes to it, you'll need to invoke
    xrdb -merge ~/.Xdefaults
    
to activate the changes. Applications get the defaults at startup, so you'll also need to restart Xdvi after making such a change.

General tips

An X application already offer a lot of customizability out-of-the box; to see what's available, you can use the program `editres'. A typical session looks like this:
  • Start first xdvi, and then editres.
  • From the editres `Commands' menu, select `Get Tree'.
  • Click the mouse on the xdvi window; after that, editres should display the entire `widget tree'.
  • Click on a widget you want to customize, or select the widget via `Tree -> Select widget in Client' in xdvi.
  • From the editres `Commands' menu, select `Show Resource box': You will see a list of all the resources defined by the application. You can either customize them directly in editres, or enter the corresponding lines to `~/.Xdefaults'. The syntax of the resources is explained in the X(1) man page; you can also work from the examples presented on this page.
A comprehensive editres tutorial can be found here.

Key and mouse bindings

To change a key or mouse binding, use the resource mainTranslations. As an example, let's assume you want the d behave the same way the space bar currently does, namly either scroll down 1/3 of a window if it is not yet at the bottom of the page, or skip to the following page otherwise. First you need to find out how the action routine invoked by the space bar is actually called. Open the xdvi man page and look for the heading KEYSTROKES, where you will find:

Space [down-or-next()] Moves down two-thirds of a window-full, or to the next page if already at the bottom of the page.

The name in square brackets down-or-next() is the action name we're looking for. To bind it to the d key, put the following into your ~/.Xdefaults file:

    xdvi.mainTranslations: #override\
       <Key>d:down-or-next()\n
    

Mouse bindings can be changed in a similar way; e.g. to additionally bind the action source-what-special() (which displays information about the source special next to the cursor position) to the the third mouse button:

    xdvi.mainTranslations: #override\
       <Key>d:down-or-next()\n\
       Ctrl<Btn3Down>:source-what-special()\n
    

Or, to make Shift + mouse wheel move a page forward/backward in the document (currently only works with the Xaw toolkit!):

    xdvi.mainTranslations: #override\
       Shift<Btn5Down>: forward-page(1)\n\
       Shift<Btn4Down>: back-page(1)
    

The man page for xdvi contains more detailed informations on the actions available, and some more customization examples.

Fonts

To use a different font for the menu buttons, popup windows etc., change the default `font' resource; e.g. for using Helvetica:
    xdvi*font: -*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*
    
The font for the statusline can also be changed independently from the menu font:
    xdvi*statusline*font: -*-helvetica-medium-r-*-*-11-*-*-*-*-*-*-*    
    

Toolbar (Motif only)

You can add/remove buttons to the toolbar via the X resource toolbarTranslations; see the man page for an example. The appearance of the toolbar buttons can be customized as follows:
toolbar-1
Default appearance with `flat' buttons (xdvi*toolbarButtonsRaised: False)

toolbar-2
More traditional Motif style with raised buttons, using the following resources:

xdvi*toolbarButtonsRaised: True
xdvi*button*fillOnArm: True
xdvi*button*shadowThickness: 1
xdvi*toolBar.marginHeight: 0
xdvi*toolBarFrame.marginWidth: 0
xdvi*button*highlightThickness: 2
       
Last updated on Sun, 10 May 2009 22:14:06 +0200 by Stefan Ulrich Valid HTML 4.01!