swisswatch - the mother of all X Toolkit clocks
swisswatch [-option ...]
Swisswatch is an analog clock for X that is highly
customizable by means of resources.
Handles minute-hand display correctly when ticking more
often than once a minute.
Handles arbitrary number of hands and/or mark
-fg foreground color
choose a different color for the hands and marks.
-bg background color
choose a different color for the background.
the interval between updates of the display. This
should be a positive floating-point number.
-geometry geometry define the initial window
geometry; see X(1).
specify the display to use; see X(1).
causes the clock to not reshape itself and ancestors
to exactly fit the outline of the clock.
-ffs causes the second and minute hands to behave
differently at the turn of the minute. This mode
tries to mimick the Look and Feel of the swiss
federal railway clocks.
.tickTime / .TickTime
Time between ticks, in seconds. The hands will move
this often. (All hands have their positions
recomputed and redrawn each time the clock ticks.)
This is a floating-point value, though values less
than the system's clock resolution will not work
very well. Ticks occur precisely on the appropriate
boundary, regardless of when the program was
started; for example, if tickTime is 5, ticks occur
precisely when gettimeofday().tv_sec%5 changes.
.numMarks / .NumMarks
Number of sets of marks around the clock face.
.child_n.cycle / .Mark.Cycle / .Hand.Cycle
For a mark, the number of marks in set n. For a
hand, the number of ticks corresponding to one
complete turn of the hand.
.child_n.outsideEnd / .Mark.OutsideEnd
Outside end of marks in set n, as a radial distance.
.child_n.length / .Mark.Length
Length of marks in set n; the marks extend from the
outsideEnd position inward for this distance.
.child_n.phase / .Mark.Phase
Phase of mark set n. This specifies a rotation of
the whole set of marks. The default is 0, which
specifies that a mark appear at the straight-up
("12-o'clock") position, with the other number-1
marks (if any) spaced evenly around the face. If
phase is nonzero, it specifies a rotation of the
entire set of marks clockwise. The value is the
rotation, as a fraction of the distance from one
mark to the next. For example, any integer value
will have no visible effect (any desired effect
corresponds to some value in [0..1]).
Experimentation is recommended.
.child_n.centerX / .Mark.CenterX
.child_n.centerY / .Mark.CenterY
These specify where on the clock face the center of
the circle formed by the marks is to be. The X and
Y coordinates are scaled so that the bounding square
of the clock face is [-1..1] x [-1..1]. This allows
for placing circles of marks centered at points
other than the center of the clock face; this is
useful primarily in conjunction with the
corresponding options for hands.
.child_n.foreground / .Mark.Foreground
Color used to draw a mark or hand.
.nChildren / .NChildren
Number of hands and marks on the clock.
The class of the hand or mark, currently only "Hand"
and "Mark" are supported.
.child_n.width / .Hand.Width
The width of the hand. For triangular hands, this
is the width of the base; for rectangular hands,
this is the width of the rectangle; and for circular
hands, this is the diameter of the circle. If the
width of a triangular or rectangular outline hand is
zero, the hand is drawn as a single line instead of
the full shape.
.child_n.shape / .Hand.Shape
The shape of the hand. Hands can be triangular,
rectangular, or circular; the allowed values are
"triangle", "rectangle", "circle", "triangular",
"rectangular", and "circular". Illegal values
produce a complaint and a default is used.
.child_n.render / .Hand.Render
The rendition of the hand. Hands can be drawn as
outlines or as filled shapes; the allowed values are
"outline", "fill", "outlined", and "filled".
Illegal values produce a complaint and a default is
.child_n.strokeWidth / .Hand.StrokeWidth
The width of strokes used to draw the hand, when the
hand is drawn in a way that uses strokes. A value
of 0 uses so-called "thin" lines, which are often
.child_n.strokeWidthR / .Hand.StrokeWidthR
If a non-zero floating point number is specified,
the stroke width will always be the product of this
number and the clock's outer radius (in x direction
if it is an ellipsis).
.child_n.cap / .Hand.Cap
The line cap style used when drawing hands. This
produces no visual effect except when drawing
triangular or rectangular hands of width 0. Legal
values are "notlast", "butt", "round", "projecting",
"capnotlast", "capbutt", "capround", and
.child_n.join / .Hand.Join
The line join style used when drawing hands. Legal
values are "miter", "round", "bevel", "joinmiter",
joinround", and "joinbevel".
.child_n.cycle / .Hand.Cycle
The number of seconds it takes for the hand to
circle around the face once. For example, a normal
second hand will give 60, a normal minute hand 3600.
If this is small compared to the tickTime value, the
hand will move by visually large amounts each tick;
this may or may not be desirable. The value may be
.child_n.phase / .Hand.Phase
An offset applied to the time of day before
computing the hand position. To determine the
position of a hand, the following is computed:
((now - tz - phase) %
where `now' is the current time of day (obtained
with time(3)), tz is a correction factor for the
timezone as found in the tm_gmtoff field of the
structure returned by localtime(3)), phase is the
value of the phase resource for the hand, and cycle
is the value of the cycle resource for the hand.
The result is a number from 0 to 1, which is mapped
into an angular position, with 0 being straight up,
.25 being straight right, .5 being straight down,
The simplest way to determine the desired phase
value for a hand is to experiment. It is usually
obvious that the value should be a multiple of
something like 3600; try various multiples until you
get the desired hand position.
.child_n.color / .Hand.Foreground
The color used for drawing the hand. Hands are
drawn opaquely in increasing numerical order.
.child_n.center.x / .Hand.Center.X
.child_n.center.y / .Hand.Center.Y
These specify where on the clock face the pivot
point of the hand is to be. The X and Y coordinates
are scaled so that the bounding square of the clock
face is 1..1] x [-1..1]. This allows hands to
rotate about points other than the center of the
clock face, as with some watches.
.geometry / .Geometry
Geometry specification, when none is given on the
command line. If no geometry spec can be found
anywhere, the equivalent of 200x200+100+100 is used.
.background / .Background
Color used as a background for all drawing.
.name / .Name
A string, which is stored as the window manager name
for the window. If none is given, "xwatch" is used.
.iconName / .IconName
A string, which is stored as the window manager icon
name for the window. If none is given, "xwatch" is
.railroad / .Railroad
Enables or disables Swiss-railway-clock mode, as
described under the -railroad command-line option.
The value can be "true", "false", "yes", or "no".
.circular / .Circular
If set, the clock will remain circular even if one
tries to resize it to a non-circular ellipse. This
is the previous behavior. The possible values are
the same as for .swiss/.Swiss.
The distributed application defaults files define three
different looks for swisswatch. Try them out by calling it
swisswatch -name swissclock
swisswatch -name oclock
If you would like your clock to be viewable in color,
include the following in the #ifdef COLOR section you read
This will cause swisswatch to pick up the colors in the
app-defaults color customization file: /usr/lib/X11/app-
X(1), X Toolkit documentation
Copyright 1989, Massachusetts Institute of Technology.
See X(1) for a full statement of rights and permissions.
Simon Leinen, Ecole Polytechnique Federale de Lausanne
Der Mouse <mouse@larry.McRCIM.McGill.EDU> wrote the mclock
program that already featured most of the functionality:
smooth movement of the minute hand and excessive
configurability. I basically reimplemented mclock as a
Toolkit application. This manpage also contains slightly
adapted text from mclock.doc.