Awesome window manager

Last year there was a time when I was pretty much free to do whatever what I wanted to do. And in that time I did a lot of things for which I am happy that I did. One of the things I did at that time was testing different working environments. Before that I was using XFCE desktop environment. I still like it and have it installed on my pc. It is very light compared to GNOME and KDE. And it doesn't get in my way. So its good. But I had free time and nothing else to do. So I decided to test out different window managers.

The first I tested was OpenBox. And I really liked it. I understood why so many people advocate for using just a window manager and not a desktop environment. It's so snappy and light. So I configure it the way I wanted it. And then I went on a hunt for applications that had no dependencies or very few dependencies on major desktop environments. And I found applications that I liked. And I kept on configuring it the way I liked and set it up just the way I wanted it. I wasn't missing a single feature of my previous desktop environment XFCE. And I used it for like a week and was amazed at what that little program(OpenBox) can do with a little scripting and meddling in the configuration files. And then I was thinking what about other window managers? There are practically hundreds of them. I was like a kid at a fun fair. I was wondering what cool thing should I make it do next? And then I thought wait! There are hundreds of them so there must be at least one that is better suited for me. So I decided to venture in uncharted waters….

The next window manager I tried was FluxBox. It's good and has some pretty cool features like window tabbing. But I was bored from it pretty soon. Because it didn't offer anything new that was so cool that I would like to play with it for some time. So then I moved on. When I was messing with OpenBox and FluxBox I read a lot of great things about tilling window managers. I read about how tilling window managers depended on the keyboard for managing windows and how it helps to control windows form keyboard. So I was wondering hmm… a tilling window manager. Let's try it. So the first one I tried was Xmonad. And I was getting hang of it. I really started to like it. Because of Xmonad I had my first experience with Haskell. As you might know Haskell is a programming language with a rather intriguing syntax. Ten statements of c code can be written in 2 statements of Haskell. It's syntax is not very traditional and easy to understand but it's something that I wish to master someday. So using Haskell, I configured Xmonad and I liked it. And I would have stayed with it if it weren't for conky. Whatever I do, I wasn't able to properly set up conky in it. The problem was that if I wanted conky to be displayed without flickering I have to set it up in it's own window. And Xmonad would resize conky window to fill whole screen or if any other applications are running it will show the application side by side, and make it a huge mess. So I looked into alternatives of conky like Xmobar. And did set it up but ultimately I was still missing conky and so I finally gave up on Xmonad.

After that I tried a few other tilling window managers like dwm, ratpoison and poor man's tilling window manager. I liked the simplicity and speed of dwm. As a matter of fact I decided to keep it as a secondary environment along with XFCE and OpenBox. But I had the same problem with dwm. dwm also wasn't able to display conky properly. So moving on, Ratpoison is something else. I gave up on it after half an hour. And poor man's tilling window manager is just as the name suggests, poor man's tilling window manager. It isn't a real window manager. What it does is it tiles the windows in any floating window manager like OpenBox. There was one candidate remaining which I hadn't tested yet. Awesome. I hadn't touched it because of changing configuration files. It wouldn't be nice if I had to set up the window manager again every time there was an update. So I was away from it up until now but after all this I decided to give it a try.

So I tried to install it from Arch's AUR. But there was some problem in compiling the dependencies. Particularly cairo with xcb backend. I somehow sorted it out and compiled Awesome successfully. I installed it and then the first thing I tested was Conky. And it worked! I was so happy. So after that I delved into the configuration files and set it up the way I liked. The default configuration of Awesome is pretty usable so I didn't had to change much and it was pretty easy.So slowly I added things that I liked. And it all worked out in the end. So currently I am using this awesome tilling window manager known as Awesome. And in fact it is Awesome.

Quake like terminal emulator(not quite what you think)

Everyone who has used the GNU/Linux terminal knows it is a force to be reckoned with. However, it’s a pain to have to launch a terminal emulator wait for a it to load, and then have to keep Alt-Tabbing to it. That's why quake like terminal emulators exists. For those of you who don't know what a quake like terminal is, let's clear it up first. Quake is a popular first person shooter created by id software. In the game, there is a terminal that is accessible by hitting the ~ key. It is used for editing settings and variables(like changing the gravity variable so you can jump 20-30 feet high or jump & never come down by setting it to zero…) and cheats.

So basically what we want is to pop up a terminal at a press of a button & when we press the same button again, hide the terminal. Now, there are many terminal emulators are developed to just do that. Tilda and YaKuake to name a few. I was using Tilda until a few days when I decided to trim the fat from my system. Now tilda isn't very heavy on resources or anything but installing 2 terminal emulator excluding xterm seemed like a waste, so just for the heck of it I removed Tilda. As my other terminal I was using xfce4's terminal emulator Terminal. So I decided to get the same functionality with the Terminal.

So here's what I did.
I installed wmctrl utility that controls windows from command line & then wrote a little script, & saved it to ~/scripts/terminal.sh

#! /bin/bash
#title of the window you want to show/hide
TITLE="Terminal"
#application name
APP=terminal

#List all applications
if [ “`wmctrl -l | grep -c “$TITLE”`” = “0” ]
then
#start the application if it is not already running
$APP &
else
#if the application is running, determine if we should show or hide the window
if [ “`xwininfo -int -id $(xdotool getactivewindow) | grep 'Window id' | grep -c “$TITLE”`” = “0” ]
then
# show the window
wmctrl -R “$TITLE”
else
# hide the window
wmctrl -r “$TITLE” -b add,hidden
fi
fi;

& then in openbox's configuration which is located at ~/.config/openbox/rc.xml I added this in the keyboard section.

So now whenever I press the Menu key(the one that pops up right click menu), the script gets executed. Which the Terminal is not running then it runs Terminal, if it is runnning it decides if it has focus or not & then acts accordingly.

So that's what I did. This way you can get quake like functionality in the terminal emulator of your choice. If you want to use any other terminal you just need to change the variable TITLE and APP in the script. So, for example if you want to use sakura terminal, do TITLE=”sakura” & APP=sakura & you're all set.

Hunt for the perfect operating system

Last week one of my hard drive failed. At that time I was dual booting XP & Ubuntu from that drive, so I lost my bootloader grub. I installed ubuntu on my other drive. Howerver, I have 512 mb ram in my pc. Ubuntu was running good but at times it seemed slow & the issues with my graphic card(intel 82845g/gl Brookedale) & linux has, worsened my situation. Because of my graphic card Ubuntu crashed alot. So I thought why not try out some other distro? So, for past week I was doing just that.

Prerequisites :
I wanted a distribution that was lightweight & customizable. Now, there are some great lightweight distributions like Puppy & Damn Small Linux, but my pc can handle a lot more than that. I wanted something more customizable, something that doesn't come with all the softwares you use & don't use preinstalled in it. In other words, I wanted to install a bare minimal system that was light on resources.

The Hunt begins….
When I was using ubuntu I knew that one could install a minimal command line installation(without any GUI) through alternative cd or minimal cd. So I thought, why not try it? So, I got myself a minimal cd & installed a command line version. Then I installed xorg & xfce4 desktop environment. It was definately lightweight & customizable. It did fulfill my needs. However it still crashed alot. So I told myself this won't work, I'll have to look elsewhere.

Now I was back to internet forums & they seemed to point me to Ubuntu's daddy. Yes, Debian. So, I went to their website, read a few things & everything seemed to check out. This one was also a minimal install at first & then you can install whatever you need. I downloaded their cd image & installed it. Again I installed xorg, xfce4 desktop environment & a few other applications that I use. Now dabian was definately more stable & faster than ubuntu. It did crash but not that much. But, the only problem I had with it was the packeges were outdated. Not too outdated, but still outdated. Now, I could add testing repositories & get more recent packeges but I am no veteran in linux & if something breaks, I might be able to fix it or I might not & in the end I might end up loosing some data. So adding testing repositories wasn't a wise choice. Now, having latest packeges wan't one of my priorities, but it still bugged me.

So again, I was back where I started : forums & discussion boards. This time I was considering Crunchbang, Vector, Zenwalk, Gentoo or linux from scratch. Now Crunchbang is a ubuntu derivative. It is said to be a very fast & lightweight version of Ubuntu & I love Ubuntu. But, as it is based on ubuntu, probably it will inherit the issues with graphics card & it will crash a lot. Vecor linux & zenwalk both seemed to be light & customizable but I wanted to start from a minimal installation. Gentoo has a reputation for being very customizabe. Basically because you build your whole system from compiling the source code, & creating a system specifically for your pc. The only problem with gentoo is it can take a very long time to compile & install large softwares. Linux from scratch is more like a big how to than a distribution. Because it has a very high learning curve & you will learn to build your system from scratch compiling every single module from source. Now I'd love to do that but need my pc up & running. I can't use my brother's pc for a month while I compile & build my LFS system. So I was leaning towards Gentoo. The only problem was compilation time. Now I have no experience with gentoo but I have read is some discussions that it can take whole night to compile & install openoffice suite. I wanted something like gentoo but without those long compilation times. & then I found Arch…

Archlinux is a distribution that is lightweight & highly customizable. At installation it installs minimal core packeges essential for running a command line interface & from there you can build arch into whatever you like. So I installed it & rebooted. Now I was at the command line. Before now I have used only Debian based distros. So, arch's packege manager was new for me. So I familiarized myself with the commands & started building my system. As before I started from installing xorg & xfce4. Everything was running great. Gradually I installed every application I use. The repositoris are great. I found every single software that I used to use in ubuntu plus some that weren't even in ubuntu's reposotories(like dropbox). It is very light on resources & I love every single bit of it. The greatest thing about arch is it doesn't crash. It does have some problems with graphics. If I run xserver constantly for more than 5-6 hours, sometimes the graphics becomes very choppy(you can notice it in opening/moving windows). At that time all I have to do is log out from xfce session to the command line & then start xorg again & all is back to normal again.

If you want to build similar system or need help in building something like this leave a comment & i'll create a how to & post it here.

Automatically mount NTFS partition on boot

To mount ntfs partitions we need to specify where we want to mount those partitions. By default, when you mount any partition/plug in any flash drive/insert a cd, it is mounted in /media/ directory. So we'll create a directory in /media/.
Step 1 : Create directories
sudo mkdir /media/directory name
replace “directory name” with the name of the directory you want to create.
I want to create a directory named data, so I will….
sudo mkdir /media/data
Now we need to get a list of all the partitions, this command will do just that.
Step 2 : get list of all partitions in all hard drives
sudo fdisk -l
Here is the output on my pc.
noel@Daedalus:~$ sudo fdisk -l
[sudo] password for noel:

Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000becdb

Device    Boot Start  End    Blocks     Id     System
/dev/sda1 *    1      1305   10482381   7      HPFS/NTFS
/dev/sda2      1306   4864   28587667+  f W95  Ext'd (LBA)
/dev/sda5      1306   4864   28587636   7      HPFS/NTFS

Disk /dev/sdb: 10.2 GB, 10242892800 bytes
255 heads, 63 sectors/track, 1245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x03640363

Device    Boot Start End    Blocks    Id   System
/dev/sdb1      1     1147   9213246   83   Linux
/dev/sdb2      1148  1153   48195     83   Linux
/dev/sdb3      1154  1245   738990    82   Linux swap / Solaris

Now, the partition I want to mount at startup is /dev/sda5.
For that, we need to edit /etc/fstab file. This file holds the configurations of all the partitions that are mounted during boot. So DO NOT remove anything(unless you know what you are doing). All you need to do is to add one line(if you want to mount more than one ntfs partition you'll need to add one line per partition).
Step 3 : editing /etc/fstab
Now the syntax of a fstab entery is like this :
[Device] [Mount Point] [File System Type] [Options] [Dump] [Pass]
note: options in the fstab entery & option parameters in mount command are similar.
in terminal, issue this command :
sudo gedit /etc/fstab
Here, gedit is the name of the text editor i use, you can replace it by the name of whicever editor you use(like nano or vi).
add following line at the end of the file.
/dev/xxxx /media/directory name ntfs defaults,users 0 0
& replace the xxxx with the partition you want to mount, & directory name with the name of the directory you created in the first step.
so mine will look like this…
/dev/sda5 /media/data ntfs defaults,users 0 0
here defaults & users are options. If you want to know more about all the options you can read it in manual of mount command.
man mount
save file, partiotion should auto mount the next time you boot.
you can read more about fstab here : https://help.ubuntu.com/community/Fstab