LinuxCommandLibrary

xmessage

Display simple X Window System message

SYNOPSIS

xmessage [options] [-file filename | message ...]

PARAMETERS

-buttons string
    Specifies a comma-separated list of button labels to be displayed at the bottom of the message window. The first button is typically the default.

-default label
    Sets the specified button label as the default. Pressing Enter will activate this button.

-file filename
    Reads the message text from the specified filename instead of command-line arguments.

-font fontname
    Specifies the font to use for the message text. Defaults to a standard X font.

-geometry geometry
    Sets the initial size and position of the message window using standard X geometry specifications (e.g., 80x25+100+100).

-timeout seconds
    Automatically dismisses the message window after the specified number of seconds. Returns a non-zero exit status if timed out.

-print
    Prints the label of the button clicked by the user to standard output. If no button is clicked (e.g., timeout), nothing is printed.

-center
    Centers the message window on the screen.

-nearmouse
    Positions the message window near the current mouse pointer location.

-left
    Positions the message window at the far left edge of the screen.

-right
    Positions the message window at the far right edge of the screen.

-top
    Positions the message window at the top edge of the screen.

-bottom
    Positions the message window at the bottom edge of the screen.

-title title
    Sets the window manager title for the message window.

-wrap
    Enables word wrapping for long lines of text. This is often the default behavior.

-nolinebreaks
    Ignores newline characters in the input text, treating them as spaces. Use with -wrap to create a single wrapped paragraph.

-bg color / -background color
    Sets the background color of the message window.

-fg color / -foreground color
    Sets the foreground (text) color of the message.

-display display
    Specifies the X display server to connect to.

-name name
    Sets the application name for resource matching, which can influence its appearance or behavior via X resources.

DESCRIPTION

xmessage is a fundamental utility within the X Window System, designed for displaying simple textual messages in a dedicated graphical window. It serves as a straightforward way for shell scripts or command-line applications to interact with the user via a basic graphical interface without requiring complex GUI toolkit dependencies.

Users can dismiss the message by clicking one of the optional buttons or by the window manager's close function. While lacking the advanced features and polished appearance of modern dialog tools like Zenity or kdialog, xmessage remains valuable for its minimal footprint, ease of use, and ubiquitous availability on X-based systems, making it ideal for quick notifications, confirmations, or displaying errors.

CAVEATS

xmessage is a very basic X utility. It lacks advanced features like rich text formatting (beyond simple font support), complex layouts, input fields, or progress bars. Its appearance is entirely dependent on the X server's default rendering and cannot be easily themed like modern GUI applications.

It also requires an X server to be running and accessible, making it unsuitable for purely console-based environments or headless servers.

EXIT STATUS

xmessage typically returns an exit status of 0 if the user clicked one of the specified buttons. If the window was dismissed by the window manager's close button, or if a timeout occurred (via -timeout), it usually returns a non-zero status.

When the -print option is used, the label of the clicked button is also printed to standard output before exiting.

HISTORY

xmessage has been a part of the core X Window System distribution since its early versions, tracing its origins back to the MIT X Consortium. It was designed to provide a simple, ubiquitous method for graphical output from scripts and applications without relying on specific widget sets or extensive libraries. Its continued presence in X.Org Server distributions highlights its enduring utility for straightforward, low-dependency graphical notifications, even as more sophisticated desktop environments have emerged.

SEE ALSO

dialog(1), zenity(1), kdialog(1), yad(1)

Copied to clipboard