osop - other side of the pipe - outputs formatted metrics to your Stdout.
Plain output to terminal:
Paired with gobar:
First, you have to get Go. Note that version >= 1.5 is required.
$ go get github.com/distatus/osop
should get you GOing.
The only command line switch is
-c which specifies a configuration file location. Location can either be absolute or relative to
$XDG_CONFIG_DIR/osop. Defaults to
Configuration file uses toml language and consists of two sections.
The mandatory Osop section.
[Osop] delims = ["<", ">"] template = ""
Where the required template is a text/template string and optional delims specify action delimiters (defaults to
In addition to standard actions, a
stringify action is defined to take one argument and always return (possibly empty) string no matter what. This proved to be useful in some cases.
Zero or more Receiver sections.
[Name] receiver = "date" pollInterval = "1s" otherSetting1 = "setsth" otherSetting2 = "setsthelse"
Receiver represents a single data unit, such as date, system information, weather, etc. Each is configured with
[Name] which will be used inside Osop template string and
receiver, which tells what receiver to run. Receivers are case insensitive.
Different receivers might use different strategies to get the data. Some are evented (passively waiting for data to arrive), others are actively polling for data on time interval. Time interval is configured with
pollInterval, which is required for polling receivers and ignored by evented ones.
Other settings might be exposed as needed by specific receivers.
For available receivers, their settings and output format(s), see receivers section.
For a more real world examples, see my dotfiles.
Current date and/or time.
- format (required) - Golang style date format string.
Current battery state.
- number (optional) - Battery number/index. Defaults to 0.
- Charge - Current charge number as returned by the system.
- Percent - Current charge in percentage form.
- State - Possible values: "Empty", "Full", "Charging", "Discharging", "Unknown".
- metrics (required) - List of any number of values from:
- cpu percent [true|false] - Current CPU usage in percents, [per core|cumulative].
- network <interface> - Network statistics for given interface (e.g. wlan0).
- shorts (optional) - Use short (K) units, instead of full (KB). Defaults to false.
- Percent - Dictionary of cpu0, cpu1, etc. For cumulative, only cpu0 is filled.
- Network - Dictionary of network interface names to Struct:
Note that only parts relevant to values set in
metrics will actually be filled.
Weather information based on OpenWeatherMap service.
- location (required) - Either "City,Country Code" (e.g. "London,UK") or a location code.
- apiKey (required) - OpenWeatherMap API key.
- units (optional) - Either "metric" or "imperial". Defaults to "metric".
Transmission daemon information.
- address (required) - URL to transmission RPC server.
- path (optional) - Path to transmission RPC server. Defaults to "transmission/rpc".
- shorts (optional) - Use short (K/s) units, instead of full (KB/s). Defaults to false.
- address (required) - URL to MPD server.
- password (optional) - Password to MPD server.
- Song - Dictionary with current song's metadata.
- Status - Dictionary with status, as described here.
Bspwm status pieces.
- Monitors - List of Struct:
- Desktops - List of Struct:
Wingo status pieces.
- Workspaces - List of Struct:
- Clients - number of clients.