Greasemonkey Script: Gmail Unreads Summary
I am a heavy-user of Gmail and Google Apps, and I spend most of my day in either’s web interface. The great thing about using the web interface is that I can either customize it with Gmail’s Labs feature, Firefox extensions or Greasemonkey scripts. Lately, I encountered this problem with my inbox which I felt warranted a scripted solution, and so, I spent a little time to get acquainted with Greasemonkey again and wrote a simple one.
First, the problem.
The thing I dread most with opening my inbox every morning is that it’s always flooded with (duh?) emails. The speed at which emails are being sent nowadays is astonishing! After every night, my inbox is usually packed with emails from colleagues, partners, applications (automated notification), newsletters, spam and others. That’s a night’s worth, so consider my feelings after a long weekend.
Anyway, just for the record, I LOVE to adopt a zero-inbox policy, and I archive my emails VERY, VERY LIBERALLY, so if my inbox is teeming with 30-40 unread mails, that’s considered “full” or “flooded” to me. =)
To tackle the flood, I started with filters and that helped, but I am still not satisfied. Every morning, I’ll start the day in my inbox and traverse down the long, long list of unread emails to read, reply, archive or delete. However, at any single point in time, I’ll only know the number of unread emails I still have in my inbox, and no further details about these emails. Hmm.. Is there anything that I can do?
And now, the solution.
An idea struck me this morning, and I decided to give it a try. After tinkling with Greasemonkey scripting and Gmail’s Greasemonkey API for a while, I present to you: Gmail Unreads Summary!

The features of this Greasemonkey script are:
- Summary of unread emails in your current view.
- Emails are grouped by sender, with unread count.
- Every group is a quick link to filter emails by sender.
- Easy to use!
Anyway, my original intention is to create a summary for ALL the unread emails in your account. However, it’s impossible to get all that information from the client-side? Therefore, as a workaround, the summary view is only for the CURRENT VIEW which you are looking at, and the summary changes when you paginates or change views.
Give it a try! Any feedbacks? Would you like to see any other summary details?
Hmm.. I wonder if this is worthy of Gmail Labs..
Update (20-08-2009)
I have removed the “Close” functionality and replaced it with a “Toggle” functionality. This is because the “Close” functionality is buggy (as it used a GM value?) when installed as a Firefox extension. Download the script again. Thank you!
Update (29-08-2009)
I have made some bug fixes to the script to improve your overall user experience. Firstly, search urls will now make an in-browser refresh and not a full-browser refresh. Secondly. emails with “+” are now searchable too. Download the updated script. Thank you!
Update (30-08-2009)
As reported by users, the “minimize” functionality is not sticky after changing views. Therefore I have updated the script to ensure that your preference is remembered. Download the updated script. Thank you!
Update (11-09-2009)
This script has been integrated into the Firefox add-on: Better Gmail 2 since Aug 18th. Thanks to Gina of Lifehacker!
Update (20-09-2009)
This script has been removed from the Better Gmail 2 extension since version 0.9.4 because I am using a new Greasemonkey function (@require) which is somewhat incompatible with the extension. Please install this as a Greasemonkey script instead.
Update (26-11-2009)
The Gmail Greasemonkey API broke (possibly due to changes within Gmail itself), which caused the Greasemonkey script to stop functioning. I have just fixed the bug, so go ahead and download the updated version. Thank you!
Update (16-02-2010)
The Gmail Greasemonkey API broke again. I have fixed two of the broken functions, but not the third, and so, my script has lost the functionality of “auto-refresh”. However, I have added a “Refresh” link, so that refresh can still be done manually. Hopefully this is a good-enough fix for now. Please download the updated script. Thank you.
Update (21-02-2010)
In this update, I have renamed the “Refresh” link in the last update to “Refresh GMUS” and have shifted its position – putting it just beside Gmail’s own “Refresh” view link. Download the updated script now. Enjoy!
winston.yongwei