4

I've been starting to make use of Gmail's nested labels, mostly so it's easy to organize my label list that has 100 or more labels in it. But now the label tags are getting really long, making for a cluttered display and often hiding most of the actual subject line. I rarely want to see any of the parent label names in the tag.

So for example, I'm seeing:

[Work/Customers/Bobs-Hardware][Work/Projects/Christmas-Decor][Work/Project-Types/Contract]

when all I want to see is:

[Bobs-Hardware][Christmas-Decor][Contract]

Is there any way to hide this in Gmail? An add-on perhaps?

5

There is not a native Gmail setting to shorten nested label names, although Gmail will automatically shorten label names if needed:

http://gmailblog.blogspot.com/2011/04/long-label-names-in-gmail.html

However, there is a Greasemonkey script that will do exactly what you want:

http://userscripts.org/scripts/show/149052

  • This is a good tip, thanks, however Greasemonkey appears to be Firefox only. I'm looking for something like a Gmail plug-in at this point, or at least something I could use in Chrome. – David Korn Oct 15 '12 at 18:48
  • 1
    userscripts-mirror.org/scripts/show/149052 working like a charm with tampermonkey – Kuncevic Feb 21 '16 at 0:17
1

Today, in 2018, the script still works like a charm, but you have to make a little change to make it work.

Tampermonkey complained that there was no { after the IF statement, so the script now looks like:

    **// ==UserScript==
// @name        Short Labels
// @namespace   http://fluidapp.com
// @description Shortens Gmail hierarchical labels to the last part of the path
// @include       http://mail.google.com/*
// @include       https://mail.google.com/*
// @author      Scott Whittaker, Billy Gallagher
// ==/UserScript==

(function () {
    function shorten_labels() {
        // make sure we are targeting the canvas frame
        //var canvas = document.getElementById('canvas_frame').contentDocument;
        // get the labels
        var labels = document.getElementsByClassName('av');
        for (var i in labels) {
            if (!(!isNaN(parseFloat(i)) && isFinite(i))){
                continue;
            }
            var label = labels[i];
            var shortLabel = label.innerHTML.split('/').pop();
            label.innerHTML = shortLabel;
        }
    }

    window.setInterval(shorten_labels, 5000);
})();**

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.