This is just a complementary topic for Dzen, Lemonbar and Conky. Where they are also just tools in Desktop Ricing, especially Tiling Windww Manager. Dive deeper, from decoration, to fundamental code.
Goal: A script that continuously show date and time, with Dzen2, and Conky.
How not to be a Bashful Plumber.
Piping is a powerful concept in Linux and Unix. Concept is deeper than just syntax. As meaning is more important than grammar.
Piping is very common, and very easy to do it in BASH. We utilize a lot of Pipe to communicate with Dzen2 and Lemonbar. But we might need a little googling when it comes to other language. This is why I brought this topic.
Beside |
character in BASH,
most common method are using popen
,
or subProcess
.
but there are other mechanism as well,
depend on the language you deal with.
Becoming plumber automagically.
I have made few example of Pipe, Port BASH to other language, step by step for your convenience. So now we have BASH, Perl, Python, Ruby, PHP, Lua, and Haskell. These will give you overview on how to flow your stream through pipe conduit.
Make the script simple, less problem.
In short, this Pipe example has Source and Target
-
Pipe Source: using conky, or internal function
-
Pipe Target: using less command, or dzen2.
Since we want to go for walk step by step,
I use less
for Pipe target,
and later dzen2
for Pipe Target.
And for feed, we are using conky
,
and also function as a pipe source.
Dark art of daemonizing a process.
For each article I also add Fork example, so your process can run in the background, detached from console.
We only fork the previous pipe process, we use less and dzen2. We do not fork cat, or any other cute animal.
Pipe and Fork in Desktop Ricing
I have seen a lot of configuration in dotfiles. Most utilize external tool written in BASH, Perl of Python. Between taste and color of your language, it is just about preferences. If you want to combine your preferred language to configure Dzen2 or Lemonbar,or any tools in need of piping and fork, then this tutorial is a good starter kit for you.
For historical reason. BASH evolve to Perl, Perl Evolve to PHP and Python. And here we are with Ruby. This is why I put these scripts.
I also add Lua. Lua only used as embedded script. But I can see Lua’s potential. I have never seen anybody utilize Lua as main scripting tools in dotfiles, except Conky, and AwesomeWM that use Lua as main scripting configuration. I myself utilize a lot of Conky a lot. So why not make a start ?
How about Haskell? This is not a scripting language but compiled. The reason is XMonad. Most people is still combined the Haskell Configuration, with BASH, conky, even Perl. Makes it looks like a Frankestein. We need a more unified approach.
And of course you have total Control of the script, e.g. color across the configuration, when you call from just one script, instead of many language.
But again, it is a matter of preferences.
Dzen2 or Lemonbar ?
Both ! I’m using Dzen2 during tutorial. And also give Lemonbar in source code.
Blog Post
Dotfiles (Source Code)
Thank you for Reading.