NAME App::FirefoxMultiAccountContainersUtils - Utilities related to Firefox Multi-Account Containers add-on VERSION This document describes version 0.018 of App::FirefoxMultiAccountContainersUtils (from Perl distribution App-FirefoxMultiAccountContainersUtils), released on 2024-10-01. SYNOPSIS DESCRIPTION This distribution includes several utilities related to Firefox multi-account containers addon: 1. firefox-container 2. firefox-mua-add-container 3. firefox-mua-dump-identities-json 4. firefox-mua-list-containers 5. firefox-mua-modify-containers 6. firefox-mua-sort-containers 7. open-firefox-container About the add-on: . FUNCTIONS firefox_mua_add_container Usage: firefox_mua_add_container(%args) -> [$status_code, $reason, $payload, \%result_meta] Add a new Firefox Multi-Account container. This utility will copy the last container record, change the name to the one you specify, and add it to the list of containers. You can also set some other attributes. This function is not exported. This function supports dry-run operation. Arguments ('*' denotes required arguments): * color => *str* (No description) * icon => *str* (No description) * name => *str* Name for the new container. * profile => *firefox::local_profile_name::default_first* (No description) Special arguments: * -dry_run => *bool* Pass -dry_run=>1 to enable simulation mode. Returns an enveloped result (an array). First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata. Return value: (any) firefox_mua_dump_identities_json Usage: firefox_mua_dump_identities_json(%args) -> [$status_code, $reason, $payload, \%result_meta] Dump the content of identities.json. This function is not exported. Arguments ('*' denotes required arguments): * profile => *firefox::local_profile_name::default_first* (No description) Returns an enveloped result (an array). First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata. Return value: (any) firefox_mua_list_containers Usage: firefox_mua_list_containers(%args) -> [$status_code, $reason, $payload, \%result_meta] List Firefox Multi-Account Containers add-on's containers. This function is not exported. Arguments ('*' denotes required arguments): * profile => *firefox::local_profile_name::default_first* (No description) Returns an enveloped result (an array). First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata. Return value: (any) firefox_mua_modify_containers Usage: firefox_mua_modify_containers(%args) -> [$status_code, $reason, $payload, \%result_meta] Modify (and delete) Firefox Multi-Account Containers add-on's containers with Perl code. Examples: * Delete all containers matching some conditions (remove -n to actually delete it): firefox_mua_modify_containers( profile => "myprofile", code => "return 0 if \$_->{icon} eq \"cart\" || \$_->{name} =~ /temp/i; \$_" ); * Delete all containers (remove -n to actually delete it): firefox_mua_modify_containers(profile => "myprofile", code => 0); * Change all icons to "dollar" and all colors to "red": firefox_mua_modify_containers( profile => "myprofile", code => "\$_->{icon} = \"dollar\"; \$_->{color} = \"red\"; \$_" ); This utility lets you modify the identity records in "containers.json" file using Perl code. The Perl code is called for every container (record). It is given the record hash in $_ and is supposed to modify and return the modified the record. It can also choose to return false to instruct deleting the record. This function is not exported. This function supports dry-run operation. Arguments ('*' denotes required arguments): * code* => *code|str* (No description) * profile => *firefox::local_profile_name::default_first* (No description) Special arguments: * -dry_run => *bool* Pass -dry_run=>1 to enable simulation mode. Returns an enveloped result (an array). First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata. Return value: (any) firefox_mua_sort_containers Usage: firefox_mua_sort_containers(%args) -> [$status_code, $reason, $payload, \%result_meta] Sort Firefox Multi-Account Containers add-on's containers. This utility was written when the Firefox Multi-Account Containers add-on does not provide a way to reorder the containers. Now it does; you can click Manage Containers then use the hamburger button to drag the containers up and down to reorder. However, this utility is still useful particularly when you have lots of containers and want to sort it in some way. This utility provides a flexible sorting mechanism via using modules. For example: % firefox-mua-sort-containers MYPROFILE % firefox-mua-sort-containers MYPROFILE -S by_example -A example=foo,bar,baz,qux will first sort your containers asciibetically, then put specific containers that you use often ("foo", "bar", "baz", "qux") at the top. This function is not exported. This function supports dry-run operation. Arguments ('*' denotes required arguments): * profile => *firefox::local_profile_name::default_first* (No description) * sort_args => *array[str]* Arguments to pass to the Sort::Sub::* routine. * sort_sub => *sortsub::spec* Name of a Sort::Sub::* module (without the prefix). Special arguments: * -dry_run => *bool* Pass -dry_run=>1 to enable simulation mode. Returns an enveloped result (an array). First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata. Return value: (any) open_firefox_container Usage: open_firefox_container(%args) -> [$status_code, $reason, $payload, \%result_meta] CLI to open URL in a new Firefox tab, in a specific multi-account container. Examples: * Open two URLs in a container called "mycontainer": open_firefox_container( container => "mycontainer", urls => ["www.example.com", "www.example.com/url2"] ); * If URL is not specified, will open a blank tab: open_firefox_container(container => "mycontainer"); * Open URL in a new tab in a new window: open_firefox_container( container => "mycontainer", urls => ["www.example.com"], extra_firefox_options_before => ["--new-window"] ); This command passes the "--new-window" option to "firefox". This utility opens a new firefox tab in a specific multi-account container. This requires the Firefox Multi-Account Containers add-on, as well as another add-on called "Open external links in a container", . The way it works, because add-ons currently do not have hooks to the CLI, is via a custom protocol handler. For example, if you want to open in a container called "mycontainer", you ask Firefox to open this URL: ext+container:name=mycontainer&url=http://www.example.com/ Ref: Related topics In Google Chrome browser, profiles is what you would use to separate sessions/cookies (and other things). Opening a URL in a specific profile from the command-line is easier with Chrome: % google-chrome --profile-directory="PROFILEDIRNAME" URL where "PROFILEDIRNAME" is a directory name under the profiles directory, typically "~/.config/google-chrome/" on Unix. You can use the list-chrome-profiles (with option "-l") (from App::ChromeUtils) to list Chrome profiles. This function is not exported. Arguments ('*' denotes required arguments): * container* => *str* (No description) * extra_firefox_options_after => *array[str]* Additional options (arguments) to put after the URLs. * extra_firefox_options_before => *array[str]* Additional options (arguments) to put before the URLs. * profile => *firefox::local_profile_name::default_first* (No description) * urls => *array[str]* (No description) Returns an enveloped result (an array). First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata. Return value: (any) HOMEPAGE Please visit the project's homepage at . SOURCE Source repository is at . SEE ALSO "Open external links in a container" add-on, (repo at ). The add-on also comes with a bash launcher script: . This "firefox-container" Perl script is a slightly enhanced version of that launcher script. Some other CLI utilities related to Firefox: App::FirefoxUtils, App::DumpFirefoxHistory. AUTHOR perlancar CONTRIBUTING To contribute, you can send patches by email/via RT, or send pull requests on GitHub. Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via: % prove -l If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me. COPYRIGHT AND LICENSE This software is copyright (c) 2024, 2023, 2022, 2020 by perlancar . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. BUGS Please report any bugs or feature requests on the bugtracker website When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.