XMESSAGE(1)

๐Ÿ“ฆ
version 7.7+7build1 ยท 3 versions
, in alpine 3.24, arch rolling, debian trixie, epel 10, epel 9, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

๐Ÿ’– xmessage ๐Ÿ’–

okay so this is the manual page for xmessage, which is a Section 1 General Commands tool. it's basically /bin/echo but make it a window, and it's giving main character energy ๐ŸŽ€โœจ


๐ŸŒธ NAME ๐ŸŒธ

xmessage - display a message or query in a window (X-based /bin/echo) ๐Ÿซถ

๐Ÿ“œ SYNOPSIS ๐Ÿ“œ

xmessage [ -buttons label1[:value1],label2[:value2], ...  ] [ options ]
-file filename
xmessage [ -buttons label1[:value1],label2[:value2], ...  ] [ options ]
message ...
xmessage [ -help | -version ]

๐Ÿ’… DESCRIPTION ๐Ÿ’…

okay so xmessage pops up a window with a message in it, and the message can come from the command line, a file, or standard input. ๐Ÿฆ‹ Along the bottom edge of the message there's a row of buttons, and if you left-click any of them, xmessage exits. ngl that's so satisfying ๐Ÿ’€

Which button you clicked gets sent back in the exit status. You can also have it write the button's label to standard output if you want, which is lowkey iconic for scripts ๐Ÿ”ฅ

This is mostly used by shell scripts, either to show the user some info or to ask them to pick something. ๐Ÿงš

Unless you give it a size, xmessage sizes itself to fit the message, up to a maximum size. If the message is too big for the window, scroll bars show up so nothing gets lost ๐ŸŒˆ

๐ŸŽ€ OPTIONS ๐ŸŽ€

these are the command line options xmessage understands, on top of the standard ones listed in X(7) ๐Ÿ’œ

  • -buttons button,button,... โ€” this makes one button for each comma-separated button argument ๐Ÿ“ The matching resource is buttons. Each button is a label, optionally followed by a colon and an exit value. The label is the name of the Command button widget that gets created, and it's also the text the user sees by default. Since it's the widget's name, you can use it to change any resource for that button. The exit value is what xmessage returns if that button gets picked. The default exit value is 100 plus the button number, and buttons are numbered from the left starting at one. If you don't use -buttons at all, the default is okay:0 ๐Ÿ™ˆ
  • -default label โ€” picks the button with a matching label as the default. If you don't set one, there's no default โœจ The matching resource is defaultButton. Hitting Return anywhere in the xmessage window will press the default button, and it gets a wider border than the others so you can spot it ๐Ÿ’–
  • -file filename โ€” the file to display ๐Ÿ“ The matching resource is file. If the filename is -, it reads from standard input. If you skip this option, xmessage shows every non-option argument, echo-style. You should give it either -file or a message on the command line, but not both, bestie ๐Ÿ™…โ€โ™€๏ธ
  • -print โ€” makes the program write the label of the pressed button to standard output ๐Ÿ–จ๏ธ It's the same as setting the printValue resource to TRUE. This is a nice way to find out which button got clicked ๐Ÿซถ
  • -center โ€” pops the window up in the center of the screen ๐ŸŒŸ Same as setting the center resource to TRUE.
  • -nearmouse โ€” pops the window up near the mouse cursor ๐Ÿญ Same as setting the nearMouse resource to TRUE.
  • -timeout secs โ€” exits with status 0 after secs seconds if nobody has clicked a button yet โฐ The matching resource is timeout.
  • -help โ€” prints a usage message and exits ๐Ÿ“–
  • -version โ€” prints the version info and exits ๐Ÿท๏ธ

๐Ÿงš WIDGET HIERARCHY ๐Ÿงš

knowing the name and position of each widget is super useful when you're setting resources for them ๐Ÿฆ‹ Here's the chart, with each widget's class and name:

Xmessage (xmessage)
     Form form
          Text message
          Command (label1)
          Command (label2)
          .
          .
          .

โš™๏ธ RESOURCES โš™๏ธ

the program has a few top-level application resources for customizing xmessage stuff ๐Ÿ’œ

  • file โ€” a String for the file to display ๐Ÿ“
  • buttons โ€” a String for the buttons to show. Check the -buttons command-line option ๐Ÿ“
  • defaultButton โ€” a String naming the default button by its label ๐Ÿ’–
  • printValue โ€” a Boolean for whether the pressed button's label gets written to standard output. The default is FALSE ๐Ÿ–จ๏ธ
  • center โ€” a Boolean for whether the window pops up in the center of the screen. The default is FALSE ๐ŸŒŸ
  • nearMouse โ€” a Boolean for whether the window pops up near the mouse cursor. The default is FALSE ๐Ÿญ
  • timeout โ€” the number of seconds before it exits with status 0. The default is 0, which means it never times out โณ
  • maxHeight (class Maximum) โ€” the max height of the text part of the window, in pixels. It's only used if no size was set in the geometry. The default is 0, which means 70% of the screen height ๐Ÿ“
  • maxWidth (class Maximum) โ€” the max width of the text part of the window, in pixels. Also only used if no size was set in the geometry. The default is 0, which means 70% of the screen width ๐Ÿ“

๐ŸŽฌ ACTIONS ๐ŸŽฌ

  • exit(value) โ€” exits right away with an exit status of value (default 0) ๐Ÿšช You can hook this up in translations to make other ways of exiting xmessage โœจ
  • default-exit() โ€” exits right away with the exit status of the default button ๐Ÿ‘‘ If there isn't a default button, this action does absolutely nothing ๐Ÿ™ƒ

๐Ÿšจ EXIT STATUS ๐Ÿšจ

โš ๏ธ if xmessage runs into an error, it returns 1, so don't use 1 as a button's exit value, or you'll be very confused later ๐Ÿ’€

๐Ÿ”— SEE ALSO ๐Ÿ”—

X(7), echo(1), cat(1) ๐ŸŒธ

๐Ÿง‘โ€๐Ÿ’ป AUTHORS ๐Ÿง‘โ€๐Ÿ’ป

Chris Peterson, MIT Project Athena ๐Ÿ’œ Stephen Gildea, X Consortium ๐Ÿซถ


bestie, that's the whole thing ๐Ÿ’… this is X Version 11, xmessage 1.0.7, and it's the XMESSAGE(1) page, periodt ๐ŸŒˆโœจ