Table of Content

This article is one part of a collection. All integrated, one related to another, featured with summary. So we can compare each other quickly.

Tutorial/ Guidance/ Article:

[ Tag Status Overview ]  [ BASH ]  [ Perl ]  [ Python ]  [ Ruby ]  [ PHP ]  [ Lua ]  [ Haskell ] [ Global Notes ]

Example Using Dzen2:

[ BASH ]  [ Perl ]  [ Python ]  [ Ruby ]  [ PHP ]  [ Lua ]  [ Haskell ]

Example Using Lemonbar:

[ BASH ]  [ Perl ]  [ Python ]  [ Ruby ]  [ PHP ]  [ Lua ]  [ Haskell ]


Why not Conky ?

HerbstluftWM is event based. Herbstclient sent its notification based on Window Event. Conky is interval based, and because of that, it cannot read HLWM event properly. For that reason, we cannot use conky for this situation.

HerbstluftWM event produced by --idle command.

$ herbstclient --idle

HerbstluftWM: Event Idle

For each tag event, tag status in HerbstluftWM should be updated. HerbstluftWM tag status produced by tag_status command.

$ herbstclient tag_status
	#1	:2	:3	:4	:5	.6	.7	.8	.9	

HerbstluftWM: Tag Status

The challenge is, to process Hersbtclient Idle Event

Dzen2 and Lemonbar is very similar, in which they render anything feed to them. No matter the input is, event based or interval based.

This tutorial only giving guidance, on how to transform the plain tag status text, into nice statusbar, whether it is Dzen2 or Lemonbar. From getting the statusbar geometry right, to aestethic aspect.

But first, knowing how to show the Herbstclient Tag

Multi Language Implementation

Why Port ?

The original HerbsluftWM equipped with one example of panel script in BASH . It is a single long file and plain. We are going to make it modular. My script is a heavy customization of the original.

I also have seen a sophisticated HLWM config in Perl in a single file. Since there is no tutorial for human for that script, I decided to write my own script, and make my own tutorial.

So why not go further, exercise scripting in few other language. From BASH, Perl, Python, Ruby, PHP, Lua, and finally the compiled Haskell. As a beginner, I found that the Haskell part is full of tricks. And that is exactly where the fun comes from.

What is not in this Guidance

No Window Manager in this tutorial.

Separate Window Manager Tutorial, and Statusbar Tutorial.

One of the most complex part of Window Manager is Statusbar. It is considered third party. It deserve its own article. And I did wrote a specific article exploring statusbar.

The code given is complete, but I breakdown the tutorial into two parts.

1 HerbstluftWM Tag Status: Statusbar (this article) Focusing on tags: herbstclient tag_status

2 HerbstluftWM Event Idle: Advance Pipe and Fork (not in this article) Focusing on event: herbstclient --idle

This will only discuss about the Statusbar.

Dzen2 or Lemonbar.

What Statusbar ?

The code in github already have a complete working example of both Dzen2 and Lemonbar. Since there are two option statusbar, Dzen2 and Lemonbar, and most of the code are similar, this tutorial should choose only one of them, and let the reader use the source code in github, in order to use other statusbar.

This blog already have Dzen2 tutorial in Pipe and Fork section. Hence, lemonbar deserve to be in this tutorial. And since lemonbar clickable areas needs more pipe, lemonbar also have more challenge compared to dzen2. But hey don’t worry, both are very similar.

Source code is available for both Dzen2 and Lemonbar.

Directory Structure

The idea is Focus

Any statusbar user would be tempted to alter their statusbar looks. So give them place in main output. script, for special customization. The rest, is static, no need to alter.

With this idea. For each language, script separated into

  • panel: Main script. The logic flow through here.

  • pipehandler: All the code horse work of piping and forking.

  • helper: Setting the geometry of statusbar.

  • output: The statusbar looks is here. So yeah, separate it, so anyone can freely modify their startup.

  • gmc: Google Material Color. Just a long Color Schemes.

  • 01-testparams and 02-testoutput: Blogging purpose. Step by step guidance.

├── panel
├── 01-testparams
├── 02-testoutput
├── pipehandler
├── helper
├── output
└── gmc

Approach on Tag Names

Instead of common practices, I’m using different approach when it comes to tag status. I’m using number as tag names, and using the number as a key, for use in statusbar, and let the statusbar show display name.

It is better this way for me, because the original tag names does not support unicode, e.g Kanji. Meanwhile, I can manage unicode from script based on key number.

In HLWM config in BASH, this would be like this

tag_names=( {1..9} )
tag_keys=( {1..9} 0 )

And in Dzen2/Lemonbar panel in BASH, this would be like this

tag_shows=( "一 ichi" "二 ni" "三 san" "四 shi" 
  "五 go" "六 roku" "七 shichi" "八 hachi" "九 kyū" "十 jū")

Before you start, you might consider to use proper HLWM config.

Proper Tag Names is a requirement.

Global Variable and Constant

This is just my personal notes.

Moved to different articles

Blog Post

The rest is in their respective article.

Let's get it started.

Dotfiles (Dzen2 Source Code)

Dotfiles (Lemonbar Source Code)

Thank you for Reading.