Goal: A guide how to write Dzen2 in Conky.
This is the continuation of dzen2 guidance. I case you have been missed it. Last week I have wrote a basic dzen tutorial using bash. And now we are going to continue with conky. It is much easier.
Table of Content
Preface: Table of Content
1: Hello World in Command Line
Conky has evolved. Now conky configuration is a Lua script. So we are going to talk about Lua programming language here. And forget about the old conky style.
Let’s do our very first conky.
There are two parts on that script above.
conky.config and the
The config will be persistent during this guidance
since we only need conky capability to dump text.
And we are going to do a lot with this text.
Now let’s run this conky. Conky will dump a formatted time text every one second interval. on the command line.
And see how the output goes through the nice command line interface.
It means you can debug your output via command line interface.
2: Simple conky-dzen2 in Script
Let’s show a simple dzen2 statusbar by put this conky
in a script
Each code lines in script should be self explanatory. If you do not understand what each line does, you should go back to our previous lesson. There few things covered:
Pipeline in command line interface
Optional transparency using either transset or transset-df
Since it require knowledge of dzen2 parameters, I suggest you this good reading.
After all, this is the output. You can see the amazingly simple dzen2 statusbar on top of the screen. With updated time every one second interval.
3: Decorating dzen2
This require knowledge of a few dzen2 tags.
^fn()We are going to use AwesomeFont to show Icons. You need to get AwseomeFont installed properly in your system. Or maybe or just put proper font in your .font directory.
^i()This tag is used to show Icon from Image Glyph. But we are going to use it to make a better Powerline like statusbar.
Here is a working example:
Just run it, and now you can see the output. Not a very pretty decoration. But I guess you get my point. Dzen output is amazingly very flexible to be configured.
4: Create Decoration for Your own Suite
Everybody has different requirement, taste and style.
Instead of giving
I’d better give the Source Image. And explain the creation process.
The creation process has been explained in previous chapter. I only use use Inkscape and GIMP with very few steps. And yeah, very simple process.
5: Dzen2 with Modularized Lua in Conky
“Let’s be tidy and get organized.”
We are going to make this Lua script themable with flexible segment monitoring statusbar. I have made quick-and dirty-scripts. It means you are free to accustomize the script for your quick-and-dirty needs. It is never intended to be a perfect script. It just works.
Le’ts see the file structure. It contains:
Main BASH script, top pipe Conky to Dzen2:
A Conky Configuration Resource, as a script entry point:
conky.lua. You can freely modify this conky by changing theme (preset and assembly).
Two submodule libraries:
One asset contain Google Material Color for convenience:
Two Themable Paths:
presetsfor color and
assemblies. You can make your own preset and assembly.
The entry point conky.lua is very simple. I have put all the stuff in libraries.
The color preset is just simpler.
Before we go to far, and got you a headache, let’s see how the dzen2 output goes.
6: Assembly the Parts
Let’s assembly each segment parts to build a nice statusbar. This is the best parts about using conky as a lua programming language. The assemby process looks neat and tidy.
The image above is simply an output of
You can change the color preset and dzen parameter to achieve other theme without a lot of effort. Just edit the conky.lua, and save. The dzen2 statusbar panel will updated automatically following the selected theme.
Here is another sample to create a bright back arrow without making a lot of effort.
You can create you own theme based on this. And for me, there is a lot of things about dzen2 and conky that I haven’t covered yet. This deserve a specific article focused on each topic. I simply do not have time to optimize the theme. It is just a quick and dirty solution.
7: Real Life Dzen2 with Lua in Conky
Now the Final part. The dzen2 statusbar example for your desktop.
Dzen2 need six bars, while lemonbar only need two bars. For code comparation you should see both source code yourself.
Coding is Fun. Especially when it comes to dzen2-conky-lua tiers. Now I have to move on to compose the next tutorial.
That is all for now. Thank you for reading.