So far as I know, Gmail doesn't have a button to show you just your unread emails. I receive a lot of mail and I'm tired of writing in the search box "in:unread in:inbox".
So today I wrote a quick Chrome extension that injects an unread email button into Gmail. Could I have found an extension somewhere that does this? Probably, but I like to know what code is interacting with my emails. You can review the very short source code for this extension by downloading it below and reading the "run.js" file.
The extension works by constantly checking to see if the Gmail buttons have been added to the DOM (HTML of the page). Once the buttons have been created it adds a new button on the end (that is a link to "in:unread in:inbox").
Here's the code for the extension:
You can add the extension by following these steps:
1) Download and unzip the extension
2) Open Chrome
3) Go to the menu option "Window" then "Extensions"
4) Enable "Developer Mode" by clicking the checkbox in the top right corner
5) Click "Load unpacked extension..." and select the folder that you unzipped the extension to
6) Open Gmail
The original code was buggy. The zip file now contains more reliable code.
The trick is that Gmail's menu bars are different for each area (i.e. "Inbox", "Drafts", etc.). Gmail makes a new menu bar when you go to a new area and hides the other ones. The new code will check to see if the count for the menu bar is right and then add the button if it's not. This gives you buttons that don't glitch in and out. Email me at firstname.lastname@example.org if you'd like a better explanation!