Zirias / xmoji

Plain X11 emoji keyboard
BSD 2-Clause "Simplified" License
102 stars 4 forks source link

Xmoji – plain X11 emoji keyboard

Xmoji is a simple emoji keyboard for X11 designed to work without relying on any toolkit or input method. It doesn't use a toolkit itself and instead renders its GUI using XRender requests.

Xmoji in fvwm3

This the successor of my qXmoji tool which used Qt for its GUI. It's already ahead feature wise, and the few minor features still missing are on the roadmap to version 1.0.

Packaging status

Features

Commandline arguments

Xmoji uses the traditional commandline syntax of X11 clients: Options start with a single dash (-), can have more than one character and can't be combined into a single option.

Xresources

Everything concerning appearance and rendering is configured in the traditional X11 way, using X resources. Xmoji only looks for them on the root window of the running X session, so make sure you upload them with the xrdb tool.

The application class defaults to Xmoji, the instance name defaults to the name of the executable (xmoji), both can be overridden on the commandline. Most resources can also be overridden on the commandline by giving the instance name of their last component, so e.g. running xmoji -emojiFont emoji-24 will set the emoji font to that font.

Fonts

Fonts are given as search patterns for fontconfig, multiple patterns can be given separated by commas, for example Noto Sans-14:bold,sans-14. Fonts are global, so can't be scoped to individual widgets.

Setting the Font resource (the class) also sets what Xmoji considers the "system default font", which is used for the default font size for all fonts that don't have an explicit size specified. This is for example relevant for scaling of the emoji font offered in runtime settings.

Generic rendering options

Colors

Colors can be given in these formats:

Colors can be scoped to individual widgets by their class and instance names. The following colors are available:

Example

The following X resources configure a slightly smaller default font (for normal text and tooltips by specifying the class name), a different emoji font, a slightly larger scroll bar, a dark color scheme and a shorter delay before displaying emoji names (by scoping the value only to EmojiButton):

Xmoji*Font: sans-10
Xmoji*emojiFont: Twitter Color Emoji
Xmoji*Foreground: #c8c6c5
Xmoji*Background: #211f1d
Xmoji*Border: #191210
Xmoji*belowBackground: #191210
Xmoji*lowestBackground: #120f0d
Xmoji*aboveBackground: #302a28
Xmoji*activeBackground: #403830
Xmoji*disabledForeground: #777777
Xmoji*selectedForeground: black
Xmoji*selectedBackground: #77ddff
Xmoji*tooltipForeground: light cyan
Xmoji*tooltipBackground: dark slate gray
Xmoji*linkForeground: dodger blue
Xmoji*hoverForeground: cyan
Xmoji*tooltipBorder: light sea green
Xmoji*scrollBarWidth: 12
Xmoji*scrollBarMinHeight: 25
Xmoji*EmojiButton.tooltipDelay: 500

Runtime configuration

Runtime configuration is stored in a configuration file. This file is automatically monitored for external changes.

By default, Xmoji will use a configuration file in these places:

The default <name> of the configuration file is based on the instance name, see also the -name commandline option. If the instance name is not xmoji, xmoji- is automatically prepended to avoid accidental name clashes with other configuration files. So if you'd e.g. run xmoji -name foobar, it will use a file named xmoji-foobar.cfg.

The full path of the configuration file can be overridden from the command line with -cfg, e.g.

xmoji -cfg /tmp/xmoji.cfg

CAUTION: Xmoji will attempt to create missing directories for storing its runtime configuration.

The file stores everything available in the Settings dialog, which you can access by right-clicking in the window, outside of an Emoji with a fly-out. The settings are described in the dialog using tooltips.

Additionally, the history of recently used emojis is also stored in the configuration file.

Building

To obtain the source from git, make sure to include submodules, e.g. with the --recurse-submodules option to git clone. Release tarballs will include everything needed for building.

Dependencies:

For example, on a Debian or Ubuntu system, you would install these packages:

libfontconfig1-dev libfreetype-dev libharfbuzz-dev libxcb-cursor-dev
libxcb-image0-dev libxcb-xkb-dev libxcb-xtest0-dev libxkbcommon-x11-dev

To build and install Xmoji, you can simply type

make
make install

If your default make utility is not GNU make (like e.g. on a BSD system), install GNU make first and type gmake instead of make.

Build options

Options can be given as variables in each make invocation, e.g. like this:

make FOO=yes
make FOO=yes install

Alternatively, they can be saved and are then used automatically, like this:

make FOO=on config
make
make install

The following build options are available:

Enabling both WITH_KQUEUE and WITH_INOTIFY at the same time is an error. Even when one of them is enabled, Xmoji will try to detect whether the configuration file is stored on NFS and in that case silently fall back to periodically calling stat() on it.