Jason Gowan

i3 + conky

Conky is a light-weight system monitor. Conky can used in the i3 window manager to manage anything from what mpd is playing to the time of day. Conky can be extended with lua scripts.

Install Conky

On Arch Linux

$ pacman -S conky

For more information on installing Conky refer to the documentation page.

Configure i3

First we need to create a shell script that outputs an infinite json string from conky.

#!/bin/sh

# Send the header so that i3bar knows we want to use JSON:
echo '{"version":1}'

# Begin the endless array.
echo '['

# We send an empty first array of blocks to make the loop simpler:
echo '[],'

# Now send blocks with information forever:
exec conky -c $HOME/.conkyrc

In our i3 configuration file we add

bar {
        status_command ~/bin/conky-i3bar
}

So the output from conky-i3bar will be rendered in i3's status bar.

Conky Configuration

Conky is configured in ~/.conkyrc.

To access the mpd daemon we need to configure the host and port it runs at.

mpd_host localhost
mpd_port 6600

We configure conky to output a json string specified by i3. For our simple case each json object needs two fields full-text and color.

Conky provides a plethora of variables. We use these variables to display the systems settings.

[
 ${if_mpd_playing}{ "full_text" : "${mpd_artist} - ${mpd_title}", "color" : "\#d466138"},${endif}
 { "full_text" : "/ ${fs_free /}" , "color" : "\#dce7ed" },
 { "full_text" : "/home ${fs_free /home}" , "color" : "\#dce7ed" },
 ${if_up enp5s0}{ "full_text" : "Wire ${addr enp5s0} \u2191${downspeedf enp5s0}k \u2193${upspeedf enp5s0}k", "color" : "\#00FF00"},${endif}
 ${if_up wlp3s0}{ "full_text" : "Wifi ${wireless_link_qual_max} ${addr wlp3s0} \u2191${downspeedf wlp3s0}k \u2193${upspeedf wlp3s0}k", "color" : "\#00FF00"},${endif}
 { "full_text" : "IO \u2191${diskio_read} \u2193${diskio_write}", "color" : "\#dce7ed"},
 { "full_text" : "CPU ${cpu cpu}%", "color" : "\#dce7ed"},
 { "full_text" : "RAM ${memperc}%" , "color" :
    ${if_match ${memperc}<90}"\#ffffff"${else}"\#ff0000"${endif} },
 { "full_text" : "${battery_short} ${battery_time}", "color" : "\#dce7ed" },
 { "full_text" : "${time %F %R}", "color" : "\#ccffff"}
],

The status bar will now be

The full conky configuration can be found on gist.