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.

Connecting to Internet via mobile phone in linux

Let me tell you how I connected to Internet using my mobile phone (Samsung c3200) on linux using wvdial. Let me break it down in steps so it is easy to understand. Let's get started.

Step 1: plug in the phone using data cable
Step 2: Running lsusb
Run lsusb command. Output on my pc is like this.

 [noel@Daedalus ~]$ lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 007: ID 04e8:6843 Samsung Electronics Co., Ltd 

Notice the last line. It means that my mobile is detected succesfully. Also notice the weird codes after ID. That's what we need.

Step 3: Loading kernel modules Kernel modules are loaded with modprobe command. For my mobile it will look like this:

 modprobe usbserial vendor=0x04e8 product=0x6843 (run as root) 

If you have different lsusb output, then use those IDs in the modprobe command.

Step 4: Configuring wvdial Normally wvdial is configured simply by executing the command wvdialconf. However, I already use wvdial for one data card and didn't want to overwrite the working config file in /etc. So I issued command:

 wvdialconf samsung.conf (run as root) 

It will write all the configurations in the samsung.conf file instead of the default /etc/wvdial.conf. Let's see what I've got.]

 Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Modem Type = USB Modem ; Phone = <Target Phone Number> ISDN = 0 ; Username = <Your Login Name> Init1 = ATZ ; Password = <Your Password> Modem = /dev/ttyACM0 Baud = 460800 

Step 5: Add the phone number and credentials. Now comes the tricky part. You need to know which number to dial and the login credentials. I have a vodafone connection here so I knew I need to dial *99# in order to connect to internet. However the problem was that the connection didn't need any username and password. It just connected to the internet. That was a problem for me. When I tried to connect to internet wvdial complained that there were no valid username and password in the configuration. The errors were:

 –> Configuration does not specify a valid login name.  –> Configuration does not specify a valid password.  

So, I installed opera mini in my mobile and went online and search for the solution. I found out that you can put username = user and password = pass as default values. I edited the configuration file accordingly. My final confinguration file looked like this.

 [Dialer Defaults] Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Modem Type = USB Modem Phone = *99# ISDN = 0 Username = user Init1 = ATZ Password = pass Modem = /dev/ttyACM0 Baud = 460800 

Then I did:

 wvdial -C samsung.conf (run as root) 

Woohooo. Internet connected via mobile.

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 :