Gmail and Google Reader in Startup Programs on Ubuntu

Ubuntu

I have tried several Email Clients and Feedreaders on Ubuntu and my primary Debian Operating System. But now I was feeling that why bother with any more software when you have Google and Firefox (Iceweasel on Debian). So, I decided to make myself a script that automatically opens my Gmail and Google Reader account in Firefox each time I log on to my computer. I thought may be some of you would find it useful.

Step 1: We need to create two files.
mailnreader1 which contains this:

#! /bin/sh
firefox http://mail.google.com/

And mailnreader2 which contains this:

#! /bin/sh
sleep 30;
firefox -new-tab http://www.google.com/reader

We are going to save these two files in /usr/bin/ directory. Once you have pasted these files please check the permissions. Select a file right click and select Properties and then click on Permissions tab. Make sure that the file is read and executeable by all. See the image below:

file permissions should look like this

These two files contain simple commands to open Firefox with specified web addresses. The sleep command tells your computer to wait for 30 seconds before running the next command. The reason behind doing this is that when your session begins your computer performs some tasks. Like loading your settings, Desktop, Nautilus, etc. My system is only 800 mghz, and If I don’t wait for 30 seconds the browser would give me an error something like this:

Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system.

If you have a faster computer you can try removing the sleep line or decrease the number of seconds.

2: Now Go to Preferences > Sessions, click on Startup Programs tab, press the Add button and add this:

mailnreader1

Press Ok and then press the Add button again to add the second file:


mailnreader2

Press Ok and then Close. Now to check these scripts out you need to Log Out and then Log In.

Why two files?

I tried creating a single file containing this code:

#! /bin/sh
firefox http://mail.google.com/
sleep 30;
firefox -new-tab http://www.google.com/reader

But it didn’t work. I hope someone would improve the script so that we don’t have to wait longer and we can add more sites all in one single script. Until then, I guess I will keep using it because it works and saves me time and hassle of fetching mail and feeds in two separate windows while browsing the web in the third window.

Related Posts

5 thoughts on “Gmail and Google Reader in Startup Programs on Ubuntu

  1. Chris, I only want Iceweasel/Firefox to show these two pages when I log on my computer. If I restart iceweasel/firefox or if I press the Home button I want it to open my current homepage not the gmail or google reader.

  2. When you run firefox for the first time it doesn’t return control to bash like it does when you run the firefox command while another window is open. To fix this you need to tell bash to run the process in the background. This is done using the & command. Here’s the script re-written in one.

    #! /bin/sh
    firefox http://mail.google.com/ &
    sleep 30;
    firefox -new-tab http://www.google.com/reader

  3. I might be missing the point here, but why don’t you just set your Firefox homepage to be gmail/google reader (you know you can have multiple tabs as your homepage right?), then just add Firefox to your Gnome session so it starts on login. Isn’t using shell scripts like this kinda redundant?

Comments are closed.