Friday, July 20, 2012

Best Gnome Extensions for Developer Efficiency

Here are some GNOME Shell extensions I've found useful as a web developer. I'm using Ubuntu 12.04 (Precise Pangolin) with GNOME Shell 3.4.1.

AlternateTab


The default window switch behavior has some undesirable behavior:
  1. It spans all of your workspaces - To me, this defeats the whole purpose of a workspace!
  2. It groups multiple instances of of a program together, requiring you to press Alt-` to see the individual windows. When you're tabbing between 3 different terminals this can be annoying.
AlternateTab gives you back the old, tried and true way of doing things, with each window being represented and limiting what is shown to your current desktop.

One remaining problem... Window Switching Delay

The default behavior and AlternateTab both cause a delay when switching windows in GNOME Shell with Alt-Tab. The comment in the code indicates that this is to not bother people with a popup when they're quickly switching windows. Maybe this works great when you only have two windows open, but once you add a third in the mix, you loose the ability to see which one you're switching to.

To hack around this, you can change the initial delay in the code. In Ubuntu 12.04 (Precise Pangolin), you can change

/usr/share/gnome-shell/extensions/alternate-tab@gnome-shell-extensions.gcampax.github.com/extensions.js

Find the following block of code:
         // We delay showing the popup so that fast Alt+Tab users aren't
         // disturbed by the popup briefly flashing.
         this._initialDelayTimeoutId = Mainloop.timeout_add(POPUP_DELAY_TIMEOUT,
                                                            Lang.bind(this, function () {
                                                                this.actor.opacity = 255;
                                                                this._initialDelayTimeoutId = 15;
                                                            }));

and change this._initialDelayTimeoutId = 0

Message Notifier

I was very unhappy with how notifications were integrated with chat programs like Pidgin and Empathy. Having pop-ups continuously jumping up on the bottom of the screen on top of Vim or a terminal got old pretty quickly.

I solved that problem by setting my status to Invisible in my chat programs and disabling notifications (click your username in the upper right and switch Notifications to "Off"). This is still being discuss here and here.

I did want some kind of indication that I got a message though. Message Notifier does exactly that. A small, unobtrusive indicator in the upper indicator bar that tells me how many unread messages I have in Empathy. Perfect!

Dock


This extension adds a small dock to the right side of your screen, hidden until you mouse-over. It shows the same things that are on the left side of the screen when you Alt-F1

I rarely use this, but sometimes it makes up for not having an always-present list of running windows, like when you're Remote Desktop'd in to another computer and it's grabbing your Alt-Tabs and other shortcut keys.

Remove Accessibility


This removes the Accessibility icon from the Top Bar.

Window Navigation


This is required for any self-respecting keyboard navigator!

When press Alt-F1 to bring up your Overview, you can release and re-press Alt to place a number on each of your running windows. Pressing that number will switch the focus to that window.

It wasn't immediately apparent that you need to release and repress Alt to make Window Navigation do anything, so don't forget.

Workspace Indicator


Maybe unnecessary, but it shows which workspace you're on in the top bar. Helpful if you always use the same Workspace configuration and often forget what you were doing!


Thursday, July 19, 2012

"Amend" a tag in git


When creating a tag in git, you sometimes notice 5 seconds later that you forgot to add a file or that you introduced a small problem. This "premature tagulation" happens to me all the time.

When I initially look for how to do this, I had just read about "amending a commit", so my natural thought process was to Google for "amend a tag in git". This isn't the right way to label this, so I'm posting for anyone that's following my incorrect line of thinking.

What you really want to do is create a new tag with same name.

git tag -a my_tag_name

With no arguments, this returns:

fatal: tag 'my_tag_name' already exists


You need to force the tag, which tells git to "put the sticky label" for the tag on another revision

git tag -a my_tag_name -f 


which does what you want.