Linux Blog

Awesome Piping

Filed under: General Linux,Quick Linux Tutorials — Kaleb at 8:01 am on Wednesday, April 23, 2008

Have you ever wanted to try a tiling window manager. But maybe you don’t want to deal with DWM and its bad config setup that forces you to recompile the app each time you change the config.

I suggest to you AwesomeWM. It was originally based on DWM, however now it is completely on its own. For those of you who don’t know, tiling window mangers are window managers that basically allow you to use ALL of y
our screen. If screen landscape is scarce on your box i suggest a tiling window manager. How do they do this? Its all about managing windows baby. What they do is they make every window you open full screen. that
s right FULL screen and if you open up more then one window in one virtual desktop it cuts them in half so that they are each using half the screen, and so on.

But this article is not about tiling window managers exactly it is about piping in awesome. The AwesomeWM has a status bar that you can edit which by default holds a list of your “tags” (virtual desktops however with a little bit different technique) and a window list of all the windows open on your current tag. However you can edit what is on this status bar with the .awesomerc. Now your asking yourself what can I put on i
t, does it have special keywords like conky or something? The answer is no. it works nothing like conky, however if you do it right you can completely replace conky.

Now how to do this. Open up your .awesomerc file with your favorite editor (i suggest vi or vim, and if you don’t know those why are you even at this site). Now you will see a bunch of lame stuff right, well you need to scroll down to the “status bar” section, this section strangely holds all the things that you will place on your status bar (the status bar section is repeatable so you can have more then one status bar as long as the name is changed).

Now with me I do not like having a list of running windows on my status bar, so I just remove that section,but I do like to have a clock on my status bar, I would assume you would like it to however I don’t know.

At first look it will seem a little complicated to make just a simple clock, but its actually not that bad once you get the hang of it.

What you need to do, for a clock, is create a “textbox” section (yes the time is TEXT strange eh).
It should look something like

textbox clock
{
text=” ”
}

the space between the “” is supposed to be a space so don’t worry about that. Now after you have this set up you are done messing with your .awesomerc. “clock” is now a keyword that you can use to pipe the clock t
o that part of your status bar.

Next what your going to want to do is create a little shell script for rendering your clock it should look something like:

#!/bin/bash

echo “0 widget_tell mystatusbar clock text `date +”%A %B %d, %Y %l:%M %p”`” | awesome-client

Now that is really complicated right. Well not really.

Honestly I have no idea what “0 widget_tell” does, I am assuming is just telling the status bar what to do.

Next in the list you have “mystatusbar” that is the name of your status bar, you should probably know the name of it.

Next should be obvious “clock” is the section of your status bar you want the data to be ported to.

After that comes “text” this just tells it that it is text and not some other type of data.

Then, inside the “ is the command you want to run. This is just the date command that has been modified to output the date in a specific format, it will output the date and time like this “Friday April 18, 2008
2:23 PM”

If you want it in a different way look at “man date” for help (its really simple).

Finally in the command you have “| awesome-client” this will pipe the command to awesome.

Now you need to have this script run on a regular basis, some people do this as a “while true” thing in there .xinit or something however since this is just a clock that only tells me minutes I use the crontab to
run this script every minute. A crontab to run this every minute should look like:
*/1 * * * * ~/scripts/clock.sh
Do all of this and you should have an up and running clock in no time. And like I said before you can put anything you want into this. Even graphics. So now that you know the basic stuff go make a pretty status bar.

Kaleb Porter

porterboy55@yahoo.com

http://kpstuff.servebeer.com (website is temporarily down)

Become independent of the system tray using conky.

Filed under: General Linux,The Linux Blog News — Kaleb at 9:19 pm on Thursday, February 7, 2008

Hello everybody it is I Kaleb from over at http://kpstuff.servebeer.com again come to talk today about an app that I have been using for a while but just recently decided to make it fix my dependence of the system tray all together.

If you read my blog regularly you would know that I am not a fan of GUI applications, I use as few of them as possible. I prefer to use command line programs instead for many reasons: one they are faster, two they are easier and quicker to use/access the features that I want from them, and three I just like the way they look.

For a long time I have used the Fluxbox window manager because it is small lightweight and over all pretty. But no matter what window manager I use: Gnome, KDE, Xfce, FluxBox or OpenBox I have always had some dependence on the system tray, which annoyed me a lot.

Some of them things that I liked a system tray for were a static clock that was always in the same spot and I could always look down and see it, also it had a few nice little icons over there for me to use at my will, like for instance, Gmail-Notify which is a little systray applet that will tell you if you have gmail or not and give you a little pop-up if you get new mail. Also this was for a while how i was telling if I had a new message in pidgin.

Then I started thinking to myself,

“All of these things could be done with Conky and I could use Conky for even more.”

So began the transformation.

If you don’t know already what Conky is, it is a little application that will put text in any format and of almost any type of data you want, weather it be the weather report for the day or the week, or your battery status, the day of the week, or your wireless link quality. It blends into your desktop very well and will give you that sweet geekish look that everybody looks for in a desktop.

First we need to install it.

Gentoo:

emerge -av conky

Make sure that you check out the use flags in Gentoo for things like “wifi” and others

Arch Linux:

pacman -S conky

Ubuntu:

apt-get install conky

Now that you have Conky installed it is time for you to figure out where on your screen you want to put it and also how you want it to look. I wont get into to much detail about how to set it up because those things can be figured out by the most green of Linux users. Also there should be an example config file for Conky that came with the install for Gentoo it is /etc/conky/conky.conf. You need to copy this file to ~/.conkyrc and then edit it at your leisure.

It is quite simple to figure out first you decided the main variables for the program then after the word TEXT you decide how your Conky will look on your desktop. What “text” you would like to see and in what fashion. It is here where you will replace your systray.The first thing I wanted my replacement system tray to display was my gmail messages, weather I had emails or not and how many. So I put together a little script that you can obtain from http://kpstuff.servebeer.com/~admin/check_gmail.sh in order to use this script you need to download it. I suggest to put it into a folder such as ~/scripts/ also make it executable with either “chmod 755 check_gmail.sh” or “chmod +x check_gmail.sh” and remember to edit check_gmail.sh for your username and password. Then you need to edit your ~/.conkyrc file under the TEXT area to resemble this

${texeci 60 ~/scripts/check_gmail.sh}

After this I wanted a clock obviously. Now the time variable has almost a million different options for the format that it gives so I will give you an example of how to set it up but you should run “man strftime” to see a full list of formatting options.

${time %I:%M%p}

This will put a time format on your Conky that resembles “02:19PM”

Yes that is right it is that easy and you can almost print anything you want on Conky even RSS feeds, I suggest you try it out at least once, but not just a little install it and run it and it doesn’t work try.

There are literally hundreds of variables that can be used in Conky and those that are not variables can be created using shell/perl/php/and ruby scripts.

For a list of variables go to http://conky.sourceforge.net/config_settings.html and http://conky.sourceforge.net/variables.html

Thank you once more for your time and remember to leave comments for any of the writers for the Linux blog because each of us would sure appreciate feedback on our writings, whether it be good or bad.