Journey Towards the Perfect Desktop Environment

Many moons ago, I wrote about how discovered Archlinux. It’s nearly 6 years and Arch hasn’t let me down. Some people say that they use it at home but not on their main production system. Well I do. And even on my main production system it hasn’t let me down. I can’t remember when was the last time that Arch actually broke for me. It’s always been there. As a solid foundation on which to build my work environment. Its a solid distro and my faith in it keeps going stronger and stronger.

But Arch is not today’s topic. Today’s topic is my desktop environment. What I use to get things done.

Setting up a new work environment in linux is not a simple thing. Not if your requirements are non-standard. And my requirements are certainly not standard. From computers, I expect efficiency above all else. So, I’m happy to sacrifice some “user friendliness” in order to gain increased efficiency. I’ve learned that the general concepts of “user friendliness” are not as useful when creating a work efficient environment. If a computer system is only to be used by you, then it fulfills its purpose if it allows you to do your work without much hoopla. Anyways, my requirements are as below:

  1. An efficient window managerI think I need to elaborate what I mean “efficient window manager” as all window managers can claim to be efficient in different sense. And all of them would be correct. So, when I say “efficient window manager” I mean,
    1. It should let me focus on my work instead of tracking which window is where.
    2. Quickness
    3. Moving around windows should be as simple as few keystrokes
    4. Ability to show multiple windows at the same time, side by side
    5. Full screen mode
    6. Mouse should be supported but not required
    7. Lightweightedness is an added bonus if available but not a requirement as long as it is quick
  2. System trayAs many of the programs support docking to a system tray, it is pretty much a requirement of all modern desktop environments.
  3. Ability to launch programs with few keystrokes
  4. Modern conveniencesThe environment should afford me all the conveniences of a modern operating system. This refers to easy connecting to wifi hotspots, auto mount for portable storage media, Bluetooth connection etc. I shouldn’t have to fiddle with configuration files every time I need to use one of the above mentioned functions.
  5. Sane handling of multiple displays.

In my opinion, the above requirements are not something extra ordinary and most of the standard desktop environments do fulfill many of them. However, there’s only one combination of softwares that works for me. This post only describes how I found the tools that have been been working for me for last 3 years smoothly, without competition from any other desktop environment. This is a very subjective piece. It should not be taken as a critique of every other environment.

The setup that I use is basically XFCE desktop environment with i3 window manager and i3bar as statusbar and system tray. In time where the other two major desktop enviroments on linux, Gnome & KDE, have gone through several major redesigns and broken workflows of many people, XFCE has stayed relatively unchanged. It has stayed consistant and predictable. And this is the reason I choose to use it. Sure, it’s not as “revolutionary” as Gnome & KDE and the development pace is slow as snail but it only means that I can rely on it without worrying what chaos the next update might wreck.

So, why don’t I use the stock XFCE with it’s own window manager XFWM which is perfectly fine on its own? I blame circumstances in which I learned linux. You see, when I started using linux about 6-7 years ago, the computer I used was about 7-8 years old at that time. It had 512MB RAM. And, I had a lot of time on my hands. So, as I went on looking for the perfect operating system, I also went on looking for efficient tools. Tools that didn’t take up much of computer’s resources but helped me accomplish various things. I also subscribed to the unix philosophy of “Do one thing and do it well”. So I looked for programs that did that.

This was the time when I learned VIM, more, less, grep, rgrep and many other command line utilities. I witnessed the beauty of what simple shell scripts can accomplish and how a desktop environment can be bent to one’s own will. Microsoft windows doesn’t offer his luxury. And this is the main reason that I continue to choose my linux work environment over MS windows or even Mac OS X. (And I have used both extensively.)

Anyways, while I was exploring various tools and trying to minimize base resource use of my system, I learned that in linux, one can run window manager stand-alone, independent of any desktop environment. And that this will reduce the overall resource use of the system as additional bells and whistles provided by the desktop environment will be stripped. I liked the idea and so the first window manager that I ran standalone was openbox. A very good window manager. After that I also tried Fluxbox which was also good.

When I was reading various online discussion on window managers, occasionally I read about “tilling window managers” and how they were better than Floating window managers. The idea intrigued me and I had all the time in the world. So I tried out Xmonad. A window manager written in haskell. It was good but something didn’t stick. Later I tried ratpoison. It was OK but too spartan. I tried dwm but disliked the idea of compiling the WM from scratch every time I needed to change configuration. Also, the configuration wasn’t a configuration but the change in the source code of the WM itself. After that I tried Awesome wm and it was really awesome. I stayed with it for a about a year. It even provided an inbuilt system tray which I didn’t get with other window managers. However the version 3.4 upgrade of Awesome WM broke backward compatibility with the previous configuration files. And this was the reason I went looking for an alternative.

At this time I had started hearing good things about the i3 window manager. So I gave it a try, and it was love at first sight. The configuration was simple, it was lightning fast, and also provided a system tray through i3bar. But it also provided certain additional features that weren’t available in other window managers. It provided innovative feature “modes” in which the window manager will enter a different state where the keys can do different things. And modes can be defined and customized as per one’s liking. It also provides a “floating” layout which is used by default for notifications, program dialogs etc. which other tilling WMs always had trouble with.

From the days of using Awesome, the first tilling window manager that used seriously, I had already learned to configure the tilling window manager to my own liking and already had developed muscle memory to do various common activities for managing windows. I had also assigned certain applications default workspaces so that I can switch to them instantly. All this was possible in i3. Additionally, using “modes” made launching applications or running scripts a matter of few keystrokes. I created an “execute mode” in which I can open programs with a single keystorke. However, it doesn’t have to be a program, I can also define a keystroke for opening a particular document or do anything that can be done through a bash shell. Furthermore, i3 handles multiple displays very well. Exactly like how I want it. i3 became my favorite window manager.

This combination of i3 + XFCE provides the bedrock of my work environment. It gives me a way to focus on my work without having to think about window management.

Technology! I will (selectively) ignore thee…

Warning: This is a rant. It’s not meant to make sense so if it doesn’t, don’t ask me. Also, it’s possible that you might loose your sanity reading this. If that happens, I take no responsibility.

For quite some time now, I’ve been successfully containing a brain explosion. This post probably is just a way to for my brain to let loose some of the pressure. What’s the pressure is about? Well, it’s technology! This is a very exciting time to live in. There is so much going on in the world of technology that there isn’t enough time to comprehend it. And that’s why my brain is going to explode!

Everyday, I set sail on the high seas of the internets and wander aimlessly following links that demand clicks through text that seems so alluring. There on different shifting sands of text and moving pictures I see electric cars, talking glass and stranger things. Visions beyond my dreams. Sometimes I wonder, am I awake or in a dream, for the world seems clothed with artificial lights. When will the sun dawn? When will the night end?

But then, I know that I’m not dreaming. How? Don’t ask. I’m not dreaming and I’m not mad! But the world doesn’t make sense. Take me to Google and show me how simple it is seek out the secret of a gleaming star. But, how can I know that by which I know? How does Google work? That is the mystery. Held in secrecy. Incomprehensible. Not because it’s too difficult or secret, but because it’s too big! This arcane piece of engineering serves millions daily. Of these millions, I am one. And recently, at Google I/O there was more mana added into that mystic soup that makes Google tick.

That reminded me of this: “Look at you, hacker. A pathetic creature of meat and bone, panting and sweating as you run through my corridors. How can you challenge a perfect, immortal machine?” That’s what comes to mind when I look at Google.

Of course, many people use Google’s services daily and don’t think about it. And that’s alright. Nothing wrong with it. But I can’t do it because that’s my field. I need to know about the happenings of the industry I work. (Although the option remains to grow a long beard, take up lisp programming and become a hermit) The industry is growing way too fast.

There is low level system programming and then there are giant pieces of arcanum like google search. All programmers work somewhere between this spectrum. Nowadays new programmers begin their journey for enlightenment somewhere between these two extremes. Supposing that all the technologies of present can be conceived as a giant pole of which one end is low level system programming and highest being the cutting edge research and things that google does, a programmer’s job is something like rope walking using our hypothetical pole as a balance pole.

But the problem is, this particular pole is shrinking at one end and rapidly growing at the other. Low level system programming is very slowly being eaten by the hardware beneath it and on the other hand new technologies come about in existence with the violence and swiftness of a wildfire. So, a programmer not only has to walk a tight rope, but he also has to constantly change the place at which he grips the pole to keep it balanced. And not to mention, with the length increase, the weight also increases…

But enough about senseless metaphors that make no sense whatsoever. Bottom line is, way too many things are happening in the world of technology that it’s not feasible to keep track of all of it. And reaching this conclusion is difficult for me because I’m an eat it all kinda guy. I want to know it all.. but it seems that I no longer have time. Not here. Not now. So, I’m going to listen to the old adage “Ignorance is a bliss” and ignore what’s not important and focus on what is.

Dual booting Windows 7 and Archlinux on Lenovo Ideapad U410

Last week I got a new laptop. Lenovo U410. It’s a nice ultrabook. However, the chief topic of this post is not to review it, however to set up Archlinux on it without loosing any of the features that are, what should I call them… um, factory inbuilt. I’m talking about a raid0 array and a one-key rescue system that came preconfigured with the system. I searched much on the internet to find a safe way to install linux on this system however all of them did something that I didn’t want to do…

The usual method went something like this: backup everything, turn off raid, turn off UEFI and enable legacy boot in the bios, and then install whatever you like. I thought if they have given such nice features then why not use them? There must be a way of installing linux in this system without nuking it first. So, I went on and found the way… I will just write down the steps here for future reference.

Goal

The system that I wanted to create was something like this: 80GB for windows, about 40GB for Archlinux (20GB root and 20GB home plus about 200MB for boot) and the remaining space for a big data partition that can be shared between windows and linux.

Partitioning

First of all, there were two drives in the system. One big 500GB hard drive and another 24GB SSD. For our purposes, we don’t need to touch the SSD. Our dealing will be solely with the big one. The system comes with 4 primary partitions preconfigured. What it means is, we can’t make any new partitions without deleting at least one partition. Now, the partitions that one can see were only two. A partition in which windows was installed and another one labeled “Lenovo” which contained drivers and other softwares that came with the system.

To reach our goal, I needed to make some adjustments to these partitions. First of all, backup all the data in the partition labeled as “Lenovo”. Around 5GB of drivers and softwares. Once that’s done, fire up a partition manager. I used the combination of Gparted and Easeus partition manager to accomplish the following tasks… however, all of it can also be done with gparted.

I used a Ubuntu live disk for gparted. Then I did the following things:

  1. Deleted the partition labeled as “Lenovo”
  2. Resized the partition that contained Windows 7 from about 420GB to 80GB
  3. Created an extended partition in the unallocated space after the windows 7 partition
  4. Created an NTFS partition for storing the data. About 325GB.
  5. Created an FAT32 partition for /boot for the linux system. About 20GB.
  6. Created an EXT4 partition for / (root) of the linux system. About 20GB.
  7. Created an EXT4 partition for /home of the linux system. Used all the remaining space… about 21GB.

You might notice that I have created a FAT32 file system for the boot partiton. Why? Well, we need it. We will not replace the windows bootloader in the MBR, rather, we’ll point the windows bootloader towards grub of our newly installed system. That grub, will be installed in a partition(specifically, the boot partition) and not the mbr. However, windows can’t see ext4 partitions… we’ll need something that the windows bootloader can see. It will probably see NTFS but it will certainly see FAT32. That’s why I went with FAT32. And, it paid off…

Installing Archlinux.

Well, I didn’t do anything special while installing Archlinux. Just follow the beginner’s guide and do the normal set up. Don’t worry about UEFI and stuff. Follow along until you come to the part where you need to install grub. There we need to take a detour. But first, we need grub installed (not in the MBR or partition but in our system. Using pacman):

pacman -S grub-bios

Once grub is available in our system, we need to install it in the boot partition. How? Like this. But for future reference, in case that if the page is edited for some reason, I’ll also post the commands here.:

modprobe dm-mod
grub-install –target=i386-pc –recheck –debug –force /dev/sdaX
chattr -i /boot/grub/i386-pc/core.img
mkdir -p /boot/grub/locale
cp /usr/share/locale/en@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
chattr +i /boot/grub/i386-pc/core.img

Note: When I issued the chattr command, it game some strange error… I looked it up but didn’t understood much. So, I decided to ignore it… seems that my computer also did the same as it works flawlessly right now. So, it doesn’t matter.

Alos, create a grub.cfg while you are at it:

grub-mkconfig -o /boot/grub/grub.cfg

So, once grub is installed in our boot partition, we need to make a copy of it’s boot info by doing the following: (Again, taken from the awesome archwiki)

my_windows_part=/dev/sdx#
my_boot_part=/dev/sdx#
mkdir /media/win
mount $my_windows_part /media/win
dd if=$my_boot_part of=/media/win/linux.bin bs=512 count=1

Adjust that to your setup and execute it. You might need to install ntfs-3g to write to the windows partition. If so, do so.

Configuring windows bootloader

Once grub has been installed, our work on the linux end has finished. Now, all we need to do is point the windows bootloader to our newly created boot partition with the info contained in the linux.bin file that we just created. To do that, I’m gonna directly quote archwiki page that I referenced earlier.


Boot to windows and open up and you should be able to see the FAT32 partition. Copy the linux.bin file to C:\. Now run cmd with administrator privileges (navigate to Start->All Programs->Accessories, Right-click on Command Prompt and select “Run as administrator.”)

bcdedit /create /d “Linux” /application BOOTSECTOR

BCDEdit will return an alphanumeric identifier for this entry that I will refer to as {ID} in the remaining steps. You’ll need to replace {ID} by the actual returned identifier. An example of {ID} is {d7294d4e-9837-11de-99ac-f3f3a79e3e93}

bcdedit /set {ID} device partition=c:
bcdedit /set {ID} path \linux.bin
bcdedit /displayorder {ID} /addlast
bcdedit /timeout 30


And that’s it. You’re good to go. Now, you can boot up both windows and linux and you haven’t sacrificed any of the nice things that came with the system. One-key rescue still works and so does the raid0 array. All in all, an ideal solution.

The operating system

My choice of operating system is GNU/Linux. The reasons are simple.

  1. I still use a decade old Pentium 4 computer with a 2.4GHz cpu and 512MB RAM (Yes, I know phones have more RAM these days…) I could just use good old windows xp, but, I don’t want to use a decade old operating system when I can use a brand new one for free of cost. Which beats windows in many aspects. However, even if I had a powerful system, I still would be running linux on top of it because it’s simply more tailored for my needs. I wouldn’t be able to do with Windows or OSX what I have done with linux. It’s very flexible.
  2. I like the package management of linux. Give one command and software is downloaded and installed ready at your disposal.
  3. Since I have started to use linux, I’ve grown to love the simple and powerful tools that it provides. Bash, vim, elinks… what’s not to like? Even if I don’t have access to graphical user interface, I can work perfectly fine with the command line. This also has helped me in recent times as at work, I need to ssh into a hosting server and set up web applications.
  4. I am a tinkerer and I like the choice and the customizability of linux. Without this aspect of it, I wouldn’t be writing this post.

Now, the question is, which distro do I use? Currently I am using Debian wheezy(which is currently a testing release). Previously I have used Arch linux for about 2 years. Before then, I did some time on Ubuntu. So, I’m not an expert in everything linux, however, I can say that I would be comfortable with pretty much any sane distro.

So, currently, the operating system that I use is Debian wheezy.

Super-duper charged Gnus with Gwene!

You might have read my previous post about Yahoo! pipes. However, they weren’t working out as I thought they would. Gnus was still taking up a lot of time to start up. So, I thought, there must be some other way to boost the start up time. I looked around and tried to find out what other people were using. After reading this transcript a couple of days ago, and reading curious little mention of Gwene, I decided to check it out this on Saturday. And so I did.

There were a few RSS feeds that I wanted to get news about but weren’t on the Gwene list, but I just added them. In couple of minutes they were populated, and ready for me to subscribe via gnus. So I invoked command:

gnus-group-browse-foreign-server

And there it was. Staring at me, the long list of all the different feeds that are tracked(is that the right word?) by Gwene. I subscribed to the ones that I wanted using “u”, and then closed the server buffer. Then, I restarted my gnus to see how fast it starts. I must say it is definitely an improvement. A significant improvement.

I looked at a few feeds and to my surprise, now I can see images from inside emacs! Amazing, it must have something to do with the protocol. However, I’m very happy with Gwene and Gnus now!

Supercharge Gnus with Yahoo! pipes

For a couple of months now, I am using emacs exclusively for a lot of things. Pretty much everything except web browsing. For it, I use luakit. I use emacs for coding, blogging, note taking, file system management, emails, rss feeds, todo management… pretty much 80% of my computer time is spent inside emacs.

However, there was a problem. I use gnus for email and rss feeds. Problem was, I have about 10-15 rss feeds and when I want to check them, I start gnus. However, because of the number of the feeds it would take a lot of time for gnus to connect to each server and update the feed list. So, I thought there should be some way to reduce this time. But I wasn’t able to think of something for some time. I tried searching emacs wiki for some improvements but couldn’t find any…

Then, I remembered something that I tried about 2-3 years ago. I don’t remember exactly when but it was good. However then, I didn’t have any use of it. But in my current situation, it could be absolutely valuable. It is Yahoo! pipes. I took all my feeds and created four pipes to gather all those rss feeds. So, now, instead of connecting to several servers for feeds, gnus only have to connect to a yahoo server and fetch four rss feeds for updates. It has reduced the start up time of gnus has been greatly reduced.

Also, by doing this, all my feeds will be stored somewhere safe and I won’t have to jumble opml files from now on. Also, when I need to add a feed, I will just add it to the pipe. No need to add/remove feeds from gnus. It will be handled automagically.

If you don’t know about it, check it out. Yahoo pipes can do a lot of things other than this. In fact, it is a very simplistic example of what it’s capable of… Anyways, if you want to check out my pipes, go here.

Org2blog. Back to wordpress.

For past few months this website was running on drupal. And it was good. Drupal is an awesome system that can do anything. I love it. However when I switched from wordpress to drupal, I wasn’t sure what I was going to create of this website. However, now, I am sure. What I need is a blog. Noting less, nothing more. So, I have decided to move back to wordpress.

There are few reasons for this. First, drupal is very versatile. It can do anything. However, for my simple blogging needs, I don’t want a website that can do a thousand things and more. I want a blog that is easy to maintain and does it’s job well. Because of drupal’s versatility, it takes a lot of time to customize it the way I want to.

Another reason is the updates. In drupal, currently there isn’t any system that updates core automatically. You have to do it manually. On the other hand, in wordpress, updates are a click away. Even the major ones!

I could have lived with that too. I could have run the old drupal without core updates. As bad as it sounds. However, the real reason for the switch is, in the title. For past few months I’ve been writing more and more blogs. However, what I used to write the blogs was this: Org-mode.

I would write them in Org-mode and then export them as html. Then, I’d copy that html in drupal’s editor and post the blog. It’s not as bad as writing all the html by hand, however I needed something better. I wanted to post my blogs directly from emacs. So I went to the great googles fro help.

The great googles showed me a path. A path to enlightenment. They showed me weblogger.el. Which could help me post my blogs directly to drupal without leaving emacs. However, it needed blog API module. As of this writing, the state of the module is, “The module is in development and does not currently work”. So, I took all than, and threw it out of the window.

I was back again to the great googles for help. This time, I came across, org2blog. And I thought sounds delicious. Let me have a look into what it can do. And Voila! It does what I want. It can also handle categories and tags. Wow!

So, I decided to switch back to wordpress. Last night, I was up until 4:30 in the morning to do the switch. I did it without major headaches. Let me give you a little summary of how I did it.

  1. Export all the posts from drupal as an rss feed. (there weren’t may. A total of 26 to be exact. So, they all came in one single regular rss. I exported it)
  2. Sort out the rss. Remove the tags and categories from rss.
  3. Import the rss posts into wordpress. (Go to tools->import->rss in the admin)
  4. Install redirection in wordpress and redirect the old urls to new one. This way, you won’t loose the search engine rankings and inbound traffic from urls posted in external sources.
  5. Set up the categories and tags.

That’s what I did. Much of it I could have done via database migration, however, I did’t have much data to migrate. So, rather than spending few days to migrate all those categories and tags via database queries, I did it by hand in matter of a couple of hours.

One thing I lost was comments. However, there weren’t many. So, I see no big loss there and I’m pretty much content with what I have right now.

Also, wordpress 3 is awesome! And so is org2blog. This post is the test how this setup works. I have already logged into wordpress via emacs. Now, let’s try publishing…

Moved to Drupal

Moved to Drupal

I have been planning to move this site to Drupal for quite some time now. Since I read about Drupal late last year I've been trying to learn more about it and move this site to Drupal. The opportunity to learn about Drupal presented itself in May when I started working on my second project. First I was planning to use wordpress for the project but when I went a little deeper in the planning phase, I realized it won't work in wordpress. So I needed something new, and thankfully I remembered Drupal. So I used Drupal for the project and learned much about the CMS.

Now I feel pretty comfortable with Drupal. So I thought this is the right time to move my site to Drupal as well as I haven't expanded it much and it should be relatively easy to switch now than later. So I moved what little data I had on my wordpress site to Drupal. Now that the site is on Drupal expect some new things!