NAME App::FirefoxMultiAccountContainersUtils - Utilities related to Firefox Multi-Account Containers add-on VERSION This document describes version 0.013 of App::FirefoxMultiAccountContainersUtils (from Perl distribution App-FirefoxMultiAccountContainersUtils), released on 2022-09-08. SYNOPSIS DESCRIPTION This distribution includes several utilities related to Firefox multi-account containers addon: * firefox-container * firefox-mua-list-containers * firefox-mua-modify-containers * firefox-mua-sort-containers * open-firefox-container About the add-on: . FUNCTIONS 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* 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* * profile* => *firefox::local_profile_name* 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* * 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"); 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: This function is not exported. Arguments ('*' denotes required arguments): * container* => *str* * profile => *firefox::local_profile_name* * urls => *array[str]* 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) 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.