cheeaun / max-tabs

A no-restart Firefox extension to set maximum number of opened tabs in a window.
https://addons.mozilla.org/en-US/firefox/addon/max-tabs/
8 stars 20 forks source link

maxtabs = 1 ignored #22

Closed kousu closed 8 years ago

kousu commented 8 years ago

If I set the maximum number of tabs to 2, 3, or 14, MaxTabs lists the correct result.

But if I set it to 0 or 1, it jumps back to using 10.

You should disallow the 0 case or disable MaxTabs in that case (0 == +infinity). I want to use the 1 case is because I'm using a tiling Window manager, which means all my windows are already tabs, and embedded tabs are irritating. I realize you intended your code to be a focus aid, not a UI hack, but it happens to be good for that for me :) -- or it would be if it didn't glitch out on this case.

Thank you.

kousu commented 8 years ago

I'm going to go out on a limb and guess that this is the culprint:

    var max = (maxTabs > 1) ? maxTabs : 10; // Max at least 2 tabs please

What's the reasoning for that comment? Could that become

    max = (maxTabs != undefined) ? ((maxTabs > 0) ? maxTabs : Infinity) : 10;

?

cheeaun commented 8 years ago

@kousu hmm if you want only one tab per window, you might as well disable tabs on Firefox completely?

kousu commented 8 years ago

I think they removed that from the UI? Am I blind?

On February 12, 2016 3:43:19 AM EST, Lim Chee Aun notifications@github.com wrote:

@kousu hmm if you want only one tab per window, you might as well disable tabs on Firefox completely?


Reply to this email directly or view it on GitHub: https://github.com/cheeaun/max-tabs/issues/22#issuecomment-183229731

kousu commented 8 years ago

screenshot from 2016-02-12 18-13-44

Yeah, the option is not even in about:config. And it's been gone for a while: https://support.mozilla.org/en-US/questions/968331

I might just fork your code and call it "Disable Tabs". That's probably cleaner than trying to shove my use case into yours.

cheeaun commented 8 years ago

@kousu oh sorry about that :cry: didn't know Firefox removed that feature. You sure there's no other extensions out there that can disable tabs? :thought_balloon:

kousu commented 8 years ago

I didn't look that hard, but it didn't seem like it. People love tabs and don't love window managers that require memorizing keyboard shortcuts, and the people who do love tiling are the kind that use lynx out of obstinant principle. I am in a small intersection.

Anyway, I took your code as a starting point and got https://github.com/kousu/disabletabs working. It has to be the simplest and most effective thing I've written in a long time, which is even more surprising since I've never written an extension before. The Jetpack SDK is pretty good. Forking turned out to be better because rather than remove all references to tabs in the menus and disable "Open new windows in new tabs instead", it's a lot more robust to just catch new tabs and turn them into new windows. That doesn't fit anywhere into MaxTab's goals. Thanks for your Development section, it was extremely useful in getting me started quickly.