A modest string writer
Alois Mahdal cc58a8979f Use UTF-8 by default in Dropbox plugin 8 years ago
include Do not mix raw and cooked lengths for trimming logic 8 years ago
plugins Use UTF-8 by default in Dropbox plugin 8 years ago
.travis.yml Add files for Travis CI and PyPI 9 years ago
INSTALL.md Rename project 10 years ago
README.md Add Travis CI build status 9 years ago
TODO.md Add TODO 9 years ago
requirements.txt Add files for Travis CI and PyPI 9 years ago
sardine Do not trim if max length is set to 0 8 years ago



Generic plugin-based monitor, mainly for use with Xfce genmon

Generic plugin-based monitor, mainly for use with Xfce genmon.


sardine [options] command [args...]


sardine is a plugin-based "pretty-printer" that allows adding own sub-commands and use them with common interface.

Typical use case is when you have a space where only limited number of characters can be displayed, but you want to display arbitrary amount of information (like name of currently playing song or status of a task), either having it trimmed gracefully or defining own way how to "squeeze" it in.

Apart from that, the plugin can define other modes of output that might suit other targets better. For example, genmon Xfce plugin is able to periodically display output of a command in desktop panel. Apart from displaying simple string, it can parse XML-like content and use it to display tooltip or an icon. You could implement mode in your plugin for this target, and use sardine both for your Xfce panel and your terminal in a consistent manner.


-c, --chars chars limit in charcters

--format format output format: plain for plain text, xgp for xfce4-genmon-plugin. User- defined format names must start with x- prefix.

-p, --plain same as --format=plain

-x, --xgp same as --format=xgp

-h, --help print help message

--version show version


These are pretty useless for real life, they only serve for illustration of basic concept or as examples of how to implement your own plugin.


This one takes first argument as a command name and runs it as a new process, passing the rest of arguments to it untouched:

$ sardine sh uname -a
Linux fullmoon.brq.redhat.com 3.13.6-...
$ sardine sh who
somebody  tty1         2014-03-28 19:...

Note that arguments are untouched, so things like wildcards/globs will not work (unless the shell where you type the sardine command expands them).


Connects the arguments and prints them:

$ sardine echo hello
$ sardine echo "one two"   "three"
one twothree


Dumps the arguments as Python sees them (using repr() builtin)

$ sardine dump "one two"   "three"
args = ['one two', 'three']
$ sardine dump uname -a
args = ['uname', '-a']


plugins folder where plugins are stored

/etc/sardine/config system-wide configuration file

~/.config/sardine/config user's personal config

~/.local/share/sardine/plugins/ plugin local storage (if needed)


SARDINE_PLUGINS Alternate folder for plugins


Alois Mahdal alois.mahdal@zxcvb.cz


xfce4-genmon-plugin page

Build Status