Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to reorganize Containers #330

Closed
gwynnarth opened this issue Mar 3, 2017 · 50 comments
Closed

Add ability to reorganize Containers #330

gwynnarth opened this issue Mar 3, 2017 · 50 comments

Comments

@gwynnarth
Copy link

It would be useful if users could change the order of Containers after they are created.

@jonathanKingston
Copy link
Contributor

I actually think this could be solved with drag and drop when in edit mode using the browser action.

We would need some form of index adding to the storage to remember what to display them into though.

@groovecoder groovecoder removed this from the Stretch milestone Apr 28, 2017
@erickt
Copy link

erickt commented Jun 17, 2017

It would also be nice to alphabetically sort the containers. I use a lot of containers to manage a bunch of Amazon environments, so it's always a bit of a pain to find the right one.

@billturk
Copy link

Yes being able to alphabetically sort the containers would help a lot!!!

@bluke
Copy link

bluke commented Aug 14, 2017

This will also need to allow to change the position of the default contianer compared to other containers.

@smichel17
Copy link

smichel17 commented Oct 3, 2017

Perhaps it would make more sense to add this functionality to about:preferences#containers ?

For search visibility: arrange, rearrange, reorder

@Narvey
Copy link

Narvey commented Nov 1, 2017

Yes @smichel17 , we should be able to manually order our containers, and have that affect the Sort Containers button (which seems to be useless at the moment, somebody correct me if I'm wrong).

@t4777sd
Copy link

t4777sd commented Nov 13, 2017

Definitely agree. Not being able to sort the containers makes them a lot more difficult to work with.

@psychoslave
Copy link

I use containers as tabgroups replacement, I already defined more the 30 containers and I only use them since yersterday. Grouping alphabeticaly would be fine for me as I use a "theme/subtheme" nomemclature, however being able to drag&drop to move them around would be a big plus.

Note really the issue topic, but being able to switch context and only display included tabs with one click would be great. The current behaviour seems to be "open a new tab in this container" which is really odd for my use. To achieve what I want to do, I have to go in the target container submenu, select one tab, then go back to the container menu, find the container I no longer want to display, go in the submenu and finally hide it. What I'm accustomed to with the grouptabs was "drop down list of group, select, tada" for the same result.

Having better isolation is fine, but in my priority list it's really far, far, far behind being able to easily switch context, that is having a group of tabs.

@RadonX
Copy link

RadonX commented Nov 22, 2017

@psychoslave
Copy link

Thank you @RadonX for the suggestion. I already tested it, but it seems that currently it brings only more clutter in the toobar with 0 additional feature until some bug is fixed.

@br3n065
Copy link

br3n065 commented Dec 6, 2017

I've deleted/repurposed far to many containers, an option to rearrange them manually or alphabetically would be awesome.

@o-l-a-v
Copy link

o-l-a-v commented Dec 11, 2017

Please implement this. Either alphabetically or custom/ manually, or both.
To only sort by creation time, is pretty useless.

@Paarmita
Copy link

I think this will be better with drag and drop feature and initially arranging the containers in alphabetical order, it will provide a smooth and good UI/UX also.

@jonathanKingston
Copy link
Contributor

@Paarmita the only problem is some of the menus come from Firefox itself so you would have to add an index to the internal storage and sort those menus the same.

@franzjschneider
Copy link

Hard to believe it's 2019 and we're still asking for something so simple and such a no-brainer. I keep getting tempted to switch to Brave completely.

@JohnLGalt
Copy link

#1347 adds code for sorting alphabetically only, and while this is a step in the right direction, I think we need more.

Since editing the containers.json manually works perfectly, I've done it that way - but would be great to see it in the UI itself.

@franzjschneider
Copy link

After way too long a wait and a struggle to find a replacement, I ditched this extension for Simple Tab Groups. Worth the switch. It's a great extension with a good level of customization, organization, and sorting for groups. Great in combination with SortTabs for also sorting tabs by different criteria.

Simple Tab Groups by Drive4ik:
https://addons.mozilla.org/en-US/firefox/addon/simple-tab-groups/

@pethron
Copy link

pethron commented Aug 13, 2020

Consider adding sorting and grouping

@lindhe
Copy link

lindhe commented Aug 13, 2020

I like your suggestion, @pethron , but I suggest that goes as a separate PR as to not delay this even more.

@perlancar
Copy link

perlancar commented Sep 10, 2020

For those that find a PowerShell script in #1208 (a duplicate of this issue) useful: you might also want to consider an equivalent (but slightly enhanced) CLI script I've written in Perl: https://metacpan.org/pod/firefox-mua-sort-containers . It lets you sort the containers quite flexibly. I've also blogged about it.

@MurzNN
Copy link

MurzNN commented Oct 15, 2020

Additionally Multi-Account Containers popup, other place for implement reordering feature can be about:preferences#containers - in this place I already can mass remove containers via single clicks, instead of "long click quest" at Multi-Account Containers popup. But seems this page is generated via build-in Firefox functional, not via this extension?

@zanona
Copy link

zanona commented Oct 15, 2020

By having a look at @perlancar suggestion and analysing the source, I was able to manually edit ~/.mozilla/firefox/profile.default/containers.json file (you may need to adjust the path for this file depending on your platform).

I'm not completely sure yet if changing this had any negative effect besides the ones mentioned below, so please, beware.

{
  "version": 4,
  "lastUserContextId": 4,
  "identities": [
    { "name": "userContextIdInternal.webextStorageLocal", "userContextId": 4294967295, "public": false, "icon": "", "color": "", "accessKey": "" },
    { "name": "userContextIdInternal.thumbnail", "userContextId": 4294967296, "public": false, "icon": "", "color": "", "accessKey": "" },
    { "name": "Personal", "userContextId": 1, "public": true, "icon": "fingerprint", "color": "blue" },
    { "name": "Shopping", "userContextId": 2, "public": true, "icon": "cart", "color": "orange" },
    { "name": "Crypto", "userContextId": 3, "public": true, "icon": "dollar", "color": "orange" },
    { "name": "Other", "userContextId": 4, "public": true, "icon": "chill", "color": "blue" }
  ]
}

So, by manually sorting the array and restarting Firefox, the container order has been adjusted accordingly.
I've noticed that it's not needed to change the userContextId in order to make it work.
And a big disclaimer: after doing this, the cookies I had saved for each tab no longer were present, so I had to sign in to the sites I was logged in previously. Not sure what caused this, but it's important to let you know.

Relation between assigned sites and container, also seemed to get confused, but probably that's because I've changed the userContextIds

Also, you'd need to reassign your shortcuts in case you had it configured under the extension preferences. However, for an improved behaviour and not opening a new tab every time you switch context, I would recommend easy container shortcuts extension instead.

And finally, as @MurzNN suggested, this is also reflected under about:preferences#containers

@Tyler-2
Copy link

Tyler-2 commented Oct 16, 2020

And a big disclaimer: after doing this, the cookies I had saved for each tab no longer were present, so I had to sign in to the sites I was logged in previously. Not sure what caused this, but it's important to let you know.

Would that be because the cookies are store for like... Identities[0], Identities[1], etc? Seems like a bigger impact of this would be that the new site at [0] would have access to the old [0] site's cookies! But... I'm just guessing.

@zanona
Copy link

zanona commented Oct 16, 2020

Would that be because the cookies are store for like... Identities[0], Identities[1], etc? Seems like a bigger impact of this would be that the new site at [0] would have access to the old [0] site's cookies! But... I'm just guessing.

I found out that tweaking the userContextId, specially for userContextIdInternal.thumbnail and userContextIdInternal.webextStorageLocal wasn't a good idea at all. Moving them around by adjusting the position you want in the array is really not a problem, though.

I have tried in many ways after that, and keeping userContextId as is, didn't introduce any problems. At least this is how it stands for me so far. So I guess you are right, cookies are possibly being linked to the userContextId.

One example of linking a new tab to a container through an extension is given below, so it would make sense those are connected in a way, I guess?

source

    browser.tabs.create({
      cookieStoreId: context.cookieStoreId, //cookieStoreId belongs to context (container)
      index: currentTab.index + 1,
      url: currentTab.url
    });

@naamancampbell
Copy link

Yet another community solution (I am the author): ff-containers-sort - requires Python 3.6+

pip install ff-containers-sort

Features:

  • alphabetical sorting of containers
  • manual sorting mode
  • safely updates containers.json after manual changes
  • preserves Firefox private container objects
  • creates backups of Firefox Container config prior to making changes
    • deletes backups older than 7 days
  • tested on Linux, Windows & Mac

@maxxcrawford
Copy link
Collaborator

We merged in a feature to drag and drop the order of the containers!

Fixed by PR #1608

This was referenced Jan 22, 2021
@hub2git
Copy link

hub2git commented Jan 30, 2021

@maxxcrawford
After updating to Firefox 85.0 on Linux, I now can sort the containers -- as they appear in the toolbar -- by drag and drop.

But the changes are not reflected when right-clicking a link on a webpage and hovering over "Open Link in New Container Tab".

@grahamperrin

This comment has been minimized.

@jonathanKingston
Copy link
Contributor

jonathanKingston commented Jan 31, 2021

The other bug should be closed. The work needs to happen in Firefox, for which there is a bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1333395

Ideally this should have been developed at the same time.

@minhnhattonthat
Copy link

Is there a way to sort the No Container at the end instead of before all Containers?

@o-l-a-v
Copy link

o-l-a-v commented May 22, 2022

PowerShell script to sort containers alphabetically

Click to expand
#Requires -Version 5.1
<#
    .SYNOPSIS
        Sort Mozilla Firefox containers alphabetically.

    .NOTES
        # Script info
        Author:   Olav Rønnestad Birkeland | github.com/o-l-a-v
        Created:  220522
        Modified: 220522

        # Resources
        * https://bugzilla.mozilla.org/show_bug.cgi?id=1333395
        * https://github.com/mozilla/multi-account-containers/issues/330

    .EXAMPLE
        & $psISE.CurrentFile.FullPath
#>


# Input parameters
[OutputType($null)]
Param()


# PowerShell preferences
$ErrorActionPreference = 'Stop'
$InformationPreference = 'Continue'


# Close Firefox if running
Write-Information -MessageData 'Stop Firefox if running.'
Get-Process -Name 'firefox' -ErrorAction 'SilentlyContinue' | Stop-Process -Confirm:$true
$null = Start-Sleep -Seconds 1
if ($([array](Get-Process -Name 'firefox' -ErrorAction 'SilentlyContinue')).'Count' -gt 0) {
    Throw 'Firefox must be closed before proceeding.'
}


# Get file path
Write-Information -MessageData 'Get file path to containers.json.'
$ContainersFilePath = [string](
    Get-ChildItem -Path ('{0}\Mozilla\Firefox\Profiles' -f $env:APPDATA) -Filter 'containers.json' -File -Recurse | `
        Sort-Object -Property 'LastWriteTime' -Descending | `
        Select-Object -ExpandProperty 'FullName' -First 1
)
Write-Information -MessageData ('Path: "{0}".' -f $ContainersFilePath)


# Get file content
Write-Information -MessageData 'Get file content.'
$Containers = [PSCustomObject](
    Get-Content -Raw -Path $ContainersFilePath -Encoding 'UTF8' | ConvertFrom-Json
)


# Sort
Write-Information -MessageData 'Sort containers.'
$Containers.'identities' = [PSCustomObject[]]($Containers.'identities' | Sort-Object -Property 'public', 'name')


# Set
Write-Information -MessageData 'Write changes to containers.json.'
$null = Set-Content -Path $ContainersFilePath -Value ($Containers | ConvertTo-Json -Depth 2 -Compress) -Force -Encoding 'UTF8' -NoNewline


# Done
Write-Information -MessageData 'Done.'

@an0key
Copy link

an0key commented Nov 28, 2023

PowerShell script to sort containers alphabetically
Click to expand

This works well on a windows machine... was hoping that the change would sync via Mozilla/Firefox Sync, however the other machines (Macs) all seem to retain the original order.

@JohnLGalt
Copy link

Even on a new profile that you log in and sync with?

@FlominatorTM
Copy link

It would be cool if one would build a website, where you can paste the JSON and sort it, either manually or by attributes.

@blachawk
Copy link

whats the latest thoughts from the engineers behind this project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests