Skip to content

Modules

Mathilde Gilles edited this page Nov 19, 2020 · 18 revisions

Here is a list of built-in modules in bar3x Parameters are used as XML attributes, example:

<DateTime Timezone="EST" />

Table of content

Modules

DateTime

image

Display the current date and/or time.

Example: <DateTime />

Parameters

  • Timezone (string): Default: system timezone
  • Format (string): date/time format, in Golang format. Default: Mon Jan 2 3:04 PM, see below for formating options
  • OnLeftClick (handler): Default: open gnome-calendar
  • OnRightClick (handler): Default: do nothing
Type Options
Year 06 2006
Month 01 1 Jan January
Day 02 2 _2 (width two, right justified)
Weekday Mon Monday
Hours 03 3 15
Minutes 04 4
Seconds 05 5
am/pm PM pm
Timezone MST
Offset -0700 -07 -07:00 Z07:00

CPU

image

Display CPU usage, process using the most CPU and per-core usage

Example: <CPU />

Parameters

  • ShowPerCoreBars: (bool): Display per core bars. Default: true
  • ShowMaxProcess: (bool): Display the name of the process using the most CPU. Default: true
  • ShowAvgBar: (bool): Display overall CPU usage bar. Default: true
  • OnLeftClick (handler): Default: do nothing
  • OnRightClick (handler): Default: do nothing

RAM

image

Display RAM usage and process using the most RAM

Example: <RAM />

Parameters

  • Format: (enum): How do to display usage value. Default: free
    • free: Show available (free + cached) RAM in bytes
    • used: Show used (total - free - cached) RAM in bytes
    • used-percent: Show used RAM in percent
  • ShowBar: (bool): Display RAM usage Bar. Default: true
  • ShowMaxProcess: (bool): Display the name of the process using the most RAM. Default: true
  • OnLeftClick (handler): Default: do nothing
  • OnRightClick (handler): Default: do nothing

DiskUsage

image

Display the usage of a given mountpoint

Example: <DiskUsage MountPoint="/" />

Parameters

  • MountPoint: (string): Mountpoint the show the usage for. Default: /, can
  • OnLeftClick (handler): Default: do nothing
  • OnRightClick (handler): Default: do nothing

DiskBandwidth

image

Display block device(s) throughput. RX on the left, TX on the right.

Example: <DiskBandwidth Dev="sda2,sdb1" />

Parameters

  • Devs: (string list): Devices to watch. Required
  • ShowLabel: (bool): Show the device name(s)
  • OnLeftClick (handler): Default: do nothing
  • OnRightClick (handler): Default: do nothing

Interface

image

Display a network interface throughput. RX on the left, TX on the right.

Example: <Interface Iface="enp3s0" />

Parameters

  • Iface: (string): Interface to watch. Required
  • ShowLabel: (bool): Show the interface name. Default: true
  • Unit: (enum: bits / bytes): Unit to use for the counters. Default: bytes
  • OnLeftClick (handler): Default: do nothing
  • OnRightClick (handler): Default: do nothing

VPN

image

Display an icon when a VPN connection is active. Supports: NetworkManager

Example: <VPN />

Parameters

  • OnLeftClick (handler): Default: do nothing
  • OnRightClick (handler): Default: do nothing

Volume

image

Display the sound volume. Supports: Pulseaudio.

Example: <Volume />

Parameters

  • OnLeftClick (handler): Default: do nothing
  • OnRightClick (handler): Default: do nothing

Weather

image

Display the weather as an icon and the temperature from OpenWeatherMap

Example: <Weather ApiKey="<your_api_key>" Location="London, GB" />

Parameters

  • ApiKey: (string): OpenWeatherMap API key. Required. Get your API key here: https://openweathermap.org/appid
  • Location: (string): Location. Required. Get the location name by going to https://openweathermap.org/ and copying the text from "Weather in ..."
  • Unit: (enum: C / F): Celcius or Fahrenheit. Default: C
  • OnLeftClick (handler): Default: do nothing
  • OnRightClick (handler): Default: do nothing

Music

image

Display current playing music. Supports: Spotify

Example: <Music SpotifyKeyID="<your_key_id>" SpotifyKeySecret="<your_key_secret>" />

Parameters

Workspaces

Display workspace indicators. Supports: i3

Example: <Workspaces MaxWidth="100" />

Parameters

  • MaxWidth: (int): Max width of each indicator. Default: no limit

Cmd

Create your own custom modules

Examples

External script

<Cmd>my_script.sh</Cmd>

Docker container counter

<Cmd><![CDATA[
  count=$(docker ps | sed 1d | wc -l)
  echo -e "<Row><Sizer PaddingRight=\"{h_padding}\"><Icon>\uf308</Icon></Sizer><Text>$count</Text></Row>"
]]></Cmd>

Plain text

<Cmd Format="plain" Interval="15m">curl -4 -sf ifconfig.co</Cmd>

Parameters

  • Interval: (duration): Interval to run the command at. Default: 1s. Examples: 30s, 2m15s, 300ms
  • Format: (enum): How to parse the command output. Default: markup
    • plain: Output is used as simple text
    • markup: Output is parsed using bar3x markup language. See Markup documentation for more details
  • OnLeftClick (handler): Default: do nothing
  • OnRightClick (handler): Default: do nothing