30 Days of Email Domination: Getting Stylish

By Sol in Blog

I haven’t seen my inbox for two whole days. Did it miss me?

Processing Time

After 2 days away from email I had 27 messages, which took 14 minutes to process (or 1.9 messages/minute). Roughly extrapolated, I would have 95 messages after 1 week away from email, requiring 49 minutes to process. That isn’t too bad, but it does not sound like a fun way to spend the better part of an hour. At any rate, per-message processing time could definitely be improved.

Styling

After briefly testing various approaches, I’ve settled on using CSS to hide the unread count in Gmail. I’m using the Stylish add-on for Firefox to apply custom CSS rules only to Gmail:

@-moz-document url-prefix("https://mail.google.com/mail/u/0/?") {
#canvas_frame,
body > div > .nH {
    margin-left: -210px !important;
    width: 112% !important;
}

}

It’s rather rough, but it gets the job done– Gmail’s sidebar is completely hidden. Bye-bye unread message count.

Gmail sidebar hidden from view

There’s just one problem: Gmail’s sidebar is always hidden. I only want to hide the sidebar when I’m searching Gmail for a message throughout the week, not when I’m checking my email normally.

Thankfully, I found a pretty simple solution. Just as you can add arguments to Gmail’s search URL to modify the query, you can also add arguments to the URL that do absolutely nothing.

I updated the custom Gmail search bookmark that I previously created by adding _cs as an argument to the URL to identify it as a custom search:

Before:

https://mail.google.com/mail/u/0/?shva=1#search/%s

After:

https://mail.google.com/mail/u/0/?_cs=1&shva=1#search/%s

I then updated the custom CSS rules in Stylish so that it only affected pages containing the custom argument in the URL:

Before:

@-moz-document url-prefix("https://mail.google.com/mail/u/0/?")

After:

@-moz-document url-prefix("https://mail.google.com/mail/u/0/?_cs=1")

Now, when I do a custom search in Gmail, the sidebar (and unread count) is hidden, but is untouched when I load Gmail normally. Additionally, the custom argument stays in the URL as I navigate around Gmail after performing a custom search (opening messages, adjusting settings, etc.) so the sidebar remains hidden the entire time. Awesome!

For the moment, this works well, but I would ultimately like a more elegant solution than simply shifting the entire page to the left until Gmail’s sidebar is out of view. I am curious to see whether a Greasemonkey script could simply remove undesireable elements (such as the number of unread messages), but leave the rest of the page untouched.

Today’s Stats

  • Checked email: 1 time
  • Time: 14:00
  • Total messages: 27
    • Important: 0