Ramin Hossaini

Gmail-Unread-Count First

Nov
01

Lifehacker has a great Firefox plugin for Gmail (“BetterGmail”). Behind the scenes, the plugin actually runs GreaseMonkey scripts.

I have my taskbar on the left hand side of the screen. When I get an email, this means that I can’t tell I have unread messages (because the title says “Gmail – Inbox(1) – [email address]”). What I needed was a script to change it to something like “1 unread – Gmail Inbox”. Nothing against the Lifehacker plugin, but I just like having a minimal number of Firefox plugins. I already have Greasemonkey installed – so I just needed the script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Google Inbox Count Display
 
// $Id: google.cache.user.js 33 2005-12-29 16:54:00Z jon $
// Copyright (C) 2005 by Jonathon Ramsey (jonathon.ramsey@gmail.com)
 
// Modified by Gina Trapani (ginatrapani@gmail.com) 6/27/2007
// to accomodate Google Apps for your domain inboxes
 
// This file is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation; either version 2, or (at your
// option) any later version.
 
// This file is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
 
// You should have received a copy of the GNU General Public License
// along with this software; see the file COPYING. If not, write to
// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
 
// ==UserScript==
// @name           Inbox Count First
// @namespace      htt://babylon.idlevice.co.uk/javascript/greasemonkey/
// @description    See unread message count first on Gmail tab title.
// @include        http://mail.google.com/*
// @include        https://mail.google.com/*
 
// @homepage http://userscripts.org/scripts/show/10253
// @author Jon Ramsey, Gina Trapani
// @tab General
// @enabledbydefault true
// ==/UserScript==
 
 
 
 
unsafeWindow.document.watch('title',
  function(prop, oldval, newval) {
     if (matches = newval.match(/Inbox \((\d+)\)/)) {
     	names = newval.match(/\w+/)
        newval = matches[1] + ' unread - ' + names[0] + ' Inbox';
     }
     return (newval);
  });

Leave a Reply

Your email address will not be published. Required fields are marked *