Firefox 4. How to disable 'Switch to tab'?

Discussion about official Mozilla Firefox builds
Locked
KiRK_
Posts: 57
Joined: April 17th, 2006, 6:16 pm

Re: Firefox 4. How to disable 'Switch to tab'?

Post by KiRK_ »

That won't help, because you often get dozens of "Switch to tab" suggestions in the drop down list... The first "real" suggestions are at the bottom of the list. Which isn't making sense anyway.

BTW: AutoFill is a feature of Firefox. It isn't an extension or something. It has always been built-in. There is no "author" who could fix it... The parameter is browser.urlbar.autofill.
User avatar
Gingerbread Man
Posts: 7735
Joined: January 30th, 2007, 10:55 am

Re: Firefox 4. How to disable 'Switch to tab'?

Post by Gingerbread Man »

KiRK_ wrote:BTW: AutoFill is a feature of Firefox.

More info at http://kb.mozillazine.org/Inline_autocomplete

Try the Enter Selects extension. If it doesn't do what you want, at least the chances of a feature request being granted by an extension author are higher than one of your reported bugs being fixed.
Blue_Hawk
Posts: 1
Joined: October 13th, 2010, 5:15 am

Re: Firefox 4. How to disable 'Switch to tab'?

Post by Blue_Hawk »

I registered JUST to post this comment.

I HATE THIS "FEATURE".

So if the developers like it so much, they can keep it there by all means, keep it default, switched on... whatever...

But there has GOT TO BE SOME WAY to switch it off, by hook or by crook (I am working on the 'crook' angle now ;) )
WonderCsabo
Posts: 2230
Joined: June 25th, 2010, 9:29 am
Location: Budapest, Hungary

Re: Firefox 4. How to disable 'Switch to tab'?

Post by WonderCsabo »

This's not worth registering.
User avatar
Gingerbread Man
Posts: 7735
Joined: January 30th, 2007, 10:55 am

Re: Firefox 4. How to disable 'Switch to tab'?

Post by Gingerbread Man »

Blue_Hawk, since you're running a beta version you should use the Feedback button on the toolbar to send your input to the developers. You will not reach them by posting here.
WonderCsabo
Posts: 2230
Joined: June 25th, 2010, 9:29 am
Location: Budapest, Hungary

Re: Firefox 4. How to disable 'Switch to tab'?

Post by WonderCsabo »

Nor with that...
KiRK_
Posts: 57
Joined: April 17th, 2006, 6:16 pm

Re: Firefox 4. How to disable 'Switch to tab'?

Post by KiRK_ »

I've submitted it many times already using the "Feedback" button. I don't think they read it...
lithopsian
Posts: 3664
Joined: September 15th, 2010, 9:03 am

Re: Firefox 4. How to disable 'Switch to tab'?

Post by lithopsian »

I can *almost* see the use of this feature. It is slightly frustrating that it says "Switch to tab" when there are no tabs anywhere to be seen. It is slightly more frustrating that I have to fiddle about with half a dozen keys when I actually do want a new window with the same URL. It is definitely annoying that there is a bug and it keeps asking me to "switch to tab" when I closed that window hours ago. And I just want to throw stuff when it asks me to switch to tab when the only location with that URL is right there taking up my whole monitor and not needing any switching to at all.

I guess you could call it a work in progress ....
KiRK_
Posts: 57
Joined: April 17th, 2006, 6:16 pm

Re: Firefox 4. How to disable 'Switch to tab'?

Post by KiRK_ »

Don't forget that it renders AutoFill useless... I'm using AutoFill since Firefox 0.8 or something... I always liked it very much, I got used to it over the years. And now it's not working anymore most of the time - because of the "Switch to tab" mayhem.

You know how frustrating it can be when something you got used to very much suddenly isn't there anymore. Just to make room for something new you don't need at all.

ps. I'm talking about "browser.urlbar.autofill", a built-in Firefox feature, not a third-party add-on or something!
distance0
Posts: 150
Joined: October 10th, 2010, 10:22 am

Re: Firefox 4. How to disable 'Switch to tab'?

Post by distance0 »

Count me in, I hate this feature also.
urkle
Posts: 5
Joined: March 7th, 2005, 10:23 am

Re: Firefox 4. How to disable 'Switch to tab'?

Post by urkle »

the use case I have, is that have several "utility" pages for a webapp I'm building, and often times I need to open SEVERAL tabs to this page and the "switch to tab" gets in my way of accomplishing that. I was hoping there would be an about:config option to disable it, but no such luck..

"Optimize for the lay person, Harm the power user".. Sounds like the gnome philosophy.
lithopsian
Posts: 3664
Joined: September 15th, 2010, 9:03 am

Re: Firefox 4. How to disable 'Switch to tab'?

Post by lithopsian »

Not easy to disable "switch to tab". You can hide the label easily enough in CSS, but the action would remain. It is largely implemented inside the autocomplete controller component and expressed through getStyleAt as a type attribute that is then parsed into the actiontype attribute. You could hack autocomplete.xml and stop actiontype ever getting set to switchtotab. Not pretty. I'm not even sure how you would do this in an extension. You could experiment with just brutally hacking off that attribute at a late stage since I don't think there are currently any other actiontype values that could be broken.
lithopsian
Posts: 3664
Joined: September 15th, 2010, 9:03 am

Re: Firefox 4. How to disable 'Switch to tab'?

Post by lithopsian »

I had a play and it is possible to disable this feature. Currently that involves my extension overriding two xml files completely with my own hacked versions. Not pretty! It may be possible to do this with -moz-binding which would actually be usable.

For anyone that wants to have a go, the autocomplete components prepends a string "moz-action:switchtab," to the URL which is to go in the dropdown. This is then manipulated into an actiontype attribute on that element, that string is removed, the URL in the dropdown is replaced by the string "Switch to tab", and the urlbar-display element is unhidden (in CSS, based on actiontype) so you see Switch To Tab in the urlbar. Look in autocomplete.xml and urlbarBindings.xml.
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Re: Firefox 4. How to disable 'Switch to tab'?

Post by patrickjdempsey »

It's possible to *break* bindings... it's actually pretty easy to do by accident... but there may be negative repercussions if it's not done very carefully to just remove this feature and nothing else.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
lithopsian
Posts: 3664
Joined: September 15th, 2010, 9:03 am

Re: Firefox 4. How to disable 'Switch to tab'?

Post by lithopsian »

Done with -moz-binding :) I thought it wasn't working but there was just a trivial mistake with a CSS selector. I think this completely disables switch to tab. It is still all there in the background but shouldn't affect the visible behaviour of the urlbar. This is obviously inside an existing extension, but place the code anywhere you like.

CSS like this:

Code: Select all

#urlbar
{
    -moz-binding: url("chrome://NoTabs/content/NoTabs.xml#NoTabsUrlbar");
}

.autocomplete-richlistitem
{
    -moz-binding: url("chrome://NoTabs/content/NoTabs.xml#NoTabsRichlistitem");
}


And bindings like this to replace two key methods:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<bindings id="NoTabs-urlbarBindings"
      xmlns="http://www.mozilla.org/xbl"
      xmlns:html="http://www.w3.org/1999/xhtml"
      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
      xmlns:xbl="http://www.mozilla.org/xbl">

  <binding id="NoTabsUrlbar" extends="chrome://browser/content/urlbarBindings.xml#urlbar">
    <implementation implements="nsIObserver, nsIDOMEventListener">

      <!--
        onBeforeValueSet is called by the base-binding's .value setter.
        It should return the value that the setter should use.
      -->
      <method name="onBeforeValueSet">
        <parameter name="aValue"/>
        <body><![CDATA[
          this.removeAttribute("actiontype");
          this._value = aValue;
          var returnValue = aValue;
          var action = this._parseActionUrl(aValue);
          if (action) returnValue = action.param;
          return returnValue;
        ]]></body>
      </method>

    </implementation>
  </binding>

  <binding id="NoTabsRichlistitem" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete-richlistitem">
    <implementation implements="nsIDOMXULSelectControlItemElement">

      <method name="_adjustAcItem">
        <body>
          <![CDATA[
          var url = this.getAttribute("url");
          var title = this.getAttribute("title");
          var type = this.getAttribute("type");

          this.removeAttribute("actiontype");

          var setupUrl = true;

          // If the type includes an action, set up the item appropriately.
          var types = type.split(/\s+/);
          var actionIndex = types.indexOf("action");
          if (actionIndex >= 0) {
            let [,action, param] = url.match(/^moz-action:([^,]+),(.*)$/);
            url = param;

            // Remove the "action" substring so that the correct style, if any,
            // is applied below.
            types.splice(actionIndex, 1);
            type = types.join(" ");
          }

          // If we have a tag match, show the tags and icon
          if (type == "tag") {
            // Configure the extra box for tags display
            this._extraBox.hidden = false;
            this._extraBox.childNodes[0].hidden = false;
            this._extraBox.childNodes[1].hidden = true;
            this._extraBox.pack = "end";
            this._titleBox.flex = 1;

            // The title is separated from the tags by an endash
            let tags;
            [, title, tags] = title.match(/^(.+) \u2013 (.+)$/);

            // Each tag is split by a comma in an undefined order, so sort it
            let sortedTags = tags.split(",").sort().join(", ");

            // Emphasize the matching text in the tags
            this._setUpDescription(this._extra, sortedTags);

            // Treat tagged matches as bookmarks for the star
            type = "bookmark";
          } else if (type == "keyword") {
            // Configure the extra box for keyword display
            this._extraBox.hidden = false;
            this._extraBox.childNodes[0].hidden = true;
            this._extraBox.childNodes[1].hidden = false;
            this._extraBox.pack = "start";
            this._titleBox.flex = 0;

            // Put the parameters next to the title if we have any
            let search = this.getAttribute("text");
            let params = "";
            let paramsIndex = search.indexOf(' ');
            if (paramsIndex != -1)
              params = search.substr(paramsIndex + 1);

            // Emphasize the keyword parameters
            this._setUpDescription(this._extra, params);

            // Don't emphasize keyword searches in the title or url
            this.setAttribute("text", "");
          } else {
            // Hide the title's extra box if we don't need extra stuff
            this._extraBox.hidden = true;
            this._titleBox.flex = 1;
          }

          // Give the image the icon style and a special one for the type
          this._typeImage.className = "ac-type-icon" +
            (type ? " ac-result-type-" + type : "");

          // Show the url as the title if we don't have a title
          if (title == "")
            title = url;

          // Emphasize the matching search terms for the description
          this._setUpDescription(this._title, title);
          if (setupUrl)
            this._setUpDescription(this._url, url);

          // Set up overflow on a timeout because the contents of the box
          // might not have a width yet even though we just changed them
          setTimeout(this._setUpOverflow, 0, this._titleBox, this._titleOverflowEllipsis);
          setTimeout(this._setUpOverflow, 0, this._urlBox, this._urlOverflowEllipsis);
          ]]>
        </body>
      </method>
    </implementation>
  </binding>
</bindings>



Tags and keywords still seem to work, and there are no other moz-actions yet, but this is overriding a fair bit of code that obviously would prevent future changes and bug fixes reaching you. It would be nice to intercept this with a getter but the logic seems to be scattered all over. Hopefully the bugs in switch to tab will be fixed, and maybe even better ways of just opening an existing URL ( :shock: :shock: ) introduced, quickly enough that none of this matters.
Locked