Skip to content

Instantly share code, notes, and snippets.

@SilverSoldier
Last active January 26, 2023 21:03
Show Gist options
  • Save SilverSoldier/739433e99b291f2f818bc556b00780a3 to your computer and use it in GitHub Desktop.
Save SilverSoldier/739433e99b291f2f818bc556b00780a3 to your computer and use it in GitHub Desktop.
xmessage useful options

In case fonts are not being displayed with an error message (Cannot convert string "" to type FontStruct)

Create a font using xfontsel or choose a font from xlsfonts

You don't even need the entire font description.

Ex. if you have the adobe font family just use

$ ls -la | xmessage -file - -center -default okay -font -adobe-*-*-r-*--0-100-*-*-p-*-*-* -center

100 is the font size

Modifying ~/.Xresources

The default font for xmessage can be set in ~/.Xresources or ~/.Xdefaults (whichever is used) add

Xmessage*font: -adobe-*-*-r-*-*-*-100-*-*-p-*-*-*

to ~/.Xresources and run

$ xrdb load ~/.Xresources
$ ls -la | xmessage -file - -center -default okay -font -adobe-*-*-r-*--0-100-*-*-p-*-*-* -center

link: https://tronche.com/wiki/Howto_specify_X_scalable_fonts_from_the_command_line

An extension of xmessage - has all features of xmessage and more

ESC by default exits the window

Useful options in xmessage

  1. -default okay

    Hitting enter will directly close the window without having to use the mouse.

  2. -font -bitstream-terminal-bold-r-normal--18-140-100-100-c-110-iso8859-1

    NOT in the man page of xmessage

    Changes the font

    Check fonts.md in case of error message

  3. -fg blue

  4. -bg red

    NOT in the man page of xmessage

    Changes foreground color and background color respectively

  5. -file -

    Reads input from command line

    Can be used as ls | xmessage -file -

  6. -geometry

    For both size and position

    Use as $ xmessage "Hello" -geometry <height>x<width>+<X>+<Y>

Typical usage is

$ ls -la | xmessage -file - -center -default okay -font -bitstream-terminal-bold-r-normal--18-140-100-100-c-110-iso8859-1 -center
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment