Welcome to Code Couch

Resizing the left-hand labels column in Gmail – stopping multiple grab bars in Chrome

Posted by at 4:09pm on September 5, 2012.

This is a quick update to give Chrome users a better wrapper that detects whether the code has already been run. This avoids the issue of having multiple grab bars appearing.

I’ve posted the new wrapper code below. If you’re not familiar with how to use the code, following these steps should get you up and running:

  1. Copy the code below into a text editor
  2. Copy the “full monty” code from my previous post and paste it into the text editor after the line that reads “// Insert code here.”
  3. Save the file with a name that ends in “.user.js”, for example, “chromeGmailResizer.user.js”. Note: the “.user.js” extension is important as tells Chrome that this code is to be installed as a user script
  4. Drag the file into Chrome
  5. You should see a security message similar to this:

    Click the “Continue” button
  6. You should see another security message similar to this:

    Click the “Add” button
  7. You should see a confirmation message similar to this:
  8. Load Gmail, and you should see the grab bar ready to go!
// ==UserScript==
// @name           Gmail label column resizer
// @namespace      http://www.codecouch.com/
// @description    User script that allows the labels column in Gmail to be resized
// @include        http://mail.google.com/*
// @include        https://mail.google.com/*
// @match          http://mail.google.com/*
// @match          https://mail.google.com/*
// @version        1.1
// @history        1.1 Stopped duplicate grab bars and added more URL matching
// @history        1.0 Initial version
// ==/UserScript==
 
var loadGmailResizer = function() {
	if (typeof(gmonkey) != 'object' || !('load' in gmonkey)) return;
 
	// Test that there's not already a grab bar present
	if (top.loadedGmailResizer) return;
	top.loadedGmailResizer = true;
 
	// Insert code here.
	// No modification to the code is needed when running in Chrome, so the first line of code should still read:
	//
	// 	gmonkey.load(2, function(o) {
 
};
var d = document, s = d.createElement('script');
s.type = 'text/javascript';
s.textContent = '(' + loadGmailResizer.toString() + ')()';
d.body.appendChild(s);

Post to Twitter

Comments

There are 8 responses to this post.

  1. Thought you might want to know that Chrome has locked down their browser somewhat, so now you have to go into "Tools".."Extensions" and then drag-n-drop the .js file there. Otherwise it works great!! Thanks!
  2. Thanks for that info. I'll update my instructions now to add the extra step :-)
  3. Thanks for the tutorial! I've followed the instructions but the bar does not move for me. I see it but it doesn't do anything. Please advise.
  4. can anyone get this to work now?
  5. thanks for such a cool extension...makes my gmail and the cool links function way more usable!
  6. Hi, I would like to know how I can to change width of senders's columns. Thanks
  7. @Emanuel: I don't know... perhaps ask in the Gmail forums. This code is specifically for resizing the label column.
  8. All: For anyone finding that this code no longer works since late March 2013, please read my latest post dated 31st March 2013. It offers an updated wrapper that works with the latest Gmail changes.

Leave a reply

You must either log in or enter your name and email address to post a comment.

Your email address will not be published.

  • You do not need to log in to comment, but you can if you wish.
  • Log in