(function(settings, pubsub, elements) { 
    var readyOpen = function () {
            var isOpen = settings.local('isOpen'); 
            if (isOpen) 
                pubsub.publish('trigger.shell.open', { isInitial: true }); 
        },
        readySelect = function () {
            var current = settings.local('view'),
                tabElement = elements.tab(current),
                forced = current != null;
            
            if (!current || tabElement.length == 0) {
                tabElement = elements.tabHolder().find('li:not(.glimpse-active, .glimpse-disabled):first'); 
                current = tabElement.attr('data-glimpseKey');
            }
             
            if (tabElement.length > 0 && !tabElement.hasClass('glimpse-active'))
                pubsub.publish('trigger.tab.select.' + current, { key: current, forced: forced });
        },
        selected = function (args) {
            if (!args.forced)
                settings.local('view', args.key);
        };

    pubsub.subscribe('trigger.shell.ready', readyOpen);
    pubsub.subscribe('action.tab.inserted', readySelect);
    pubsub.subscribe('trigger.tab.select', selected);
})(glimpse.settings, glimpse.pubsub, glimpse.elements);

@@ -999,177 +999,1379 @@
    %7D
-;%0A%0A    pubsub.subscribe('trigger.shell.ready', readyOpen);%0A    pubsub.subscribe('action.tab.inserted', readySelect);%0A    pubsub.subscribe('trigger.tab.select', selected)
+,%0A        currentTab = '', %0A        focusStart = function(key, isOpening) %7B%0A            if (key)%0A                currentTab = key;%0A            %0A            if (currentTab) %7B %0A                pubsub.publish('action.tab.focus.start.' + currentTab, %7B isOpening: isOpening, key: currentTab %7D);%0A            %7D%0A        %7D,%0A        focusStop = function(userTermination, switchingTab, pageRedirect) %7B %0A            if (currentTab) %7B %0A                pubsub.publish('action.tab.focus.stop.' + currentTab, %7B userTermination: userTermination, switchingTab: switchingTab, pageRedirect: pageRedirect, key: currentTab %7D); %0A                currentTab = '';%0A            %7D%0A        %7D;%0A%0A    pubsub.subscribe('trigger.shell.ready', readyOpen);%0A    pubsub.subscribe('action.tab.inserted', readySelect);%0A    pubsub.subscribe('trigger.tab.select', selected);%0A    pubsub.subscribe('action.panel.showing', function(args) %7B focusStart(args.key, false); %7D);%0A    pubsub.subscribe('action.shell.opening', function() %7B focusStart(null, true); %7D);%0A    pubsub.subscribe('action.shell.closeing', function() %7B focusStop(true, false, false); %7D); %0A    pubsub.subscribe('action.shell.minimizing', function() %7B focusStop(true, false, false); %7D); %0A    pubsub.subscribe('action.panel.hiding', function() %7B focusStop(false, true, false); %7D);%0A    window.onbeforeunload = function() %7B focusStop(false, false, true); %7D
 ;%0A%7D)

Fix #37 - Added required start and stop focus events