App::FirefoxMultiAccountContainersUtils - Utilities related to Firefox Multi-Account Containers add-on
This document describes version 0.009 of App::FirefoxMultiAccountContainersUtils (from Perl distribution App-FirefoxMultiAccountContainersUtils), released on 2020-09-21.
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
About the add-on: https://addons.mozilla.org/en-US/firefox/addon/multi-account-containers/.
Usage:
firefox_container(%args) -> [status, msg, payload, 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":
firefox_container( container => "mycontainer", urls => ["www.example.com", "www.example.com/url2"] );
If URL is not specified, will open a blank tab:
firefox_container( container => "mycontainer");
This utility opens a new firefox tab in a specific multi-account container. This requires the Firefox Multi-Account Container, as well as another container called "Open external links in a container", https://addons.mozilla.org/en-US/firefox/addon/open-url-in-container/.
The way it works, because add-on currently does not have hooks to the CLI, is via a custom protocol handler. For example, if you want to open Chttp://www.example.com/ in a container called mycontainer, you ask Firefox to open this URL:
mycontainer
ext+container:name=mycontainer&url=http://www.example.com/
Ref: https://github.com/mozilla/multi-account-containers/issues/365
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) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (payload) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
Return value: (any)
firefox_mua_list_containers(%args) -> [status, msg, payload, meta]
Sort Firefox Multi-Account Containers add-on's containers.
At the time of this writing, the UI does not provide a way to sort the containers. Thus this utility.
profile* => firefox::local_profile_name
firefox_mua_modify_containers(%args) -> [status, msg, payload, meta]
Modify (and delete) Firefox Multi-Account Containers add-on's containers with Perl code.
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.
containers.json
$_
This function supports dry-run operation.
code* => code|str
Special arguments:
-dry_run => bool
Pass -dry_run=>1 to enable simulation mode.
firefox_mua_sort_containers(%args) -> [status, msg, payload, meta]
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).
Please visit the project's homepage at https://metacpan.org/release/App-FirefoxMultiAccountContainersUtils.
Source repository is at https://github.com/perlancar/perl-App-FirefoxMultiAccountContainersUtils.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-FirefoxMultiAccountContainersUtils
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.
Firefox Multi-Account Containers, https://addons.mozilla.org/en-US/firefox/addon/multi-account-containers/
Some other CLI utilities related to Firefox: App::FirefoxUtils, App::DumpFirefoxHistory.
open-browser.
perlancar <perlancar@cpan.org>
This software is copyright (c) 2020 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install App::FirefoxMultiAccountContainersUtils, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::FirefoxMultiAccountContainersUtils
CPAN shell
perl -MCPAN -e shell install App::FirefoxMultiAccountContainersUtils
For more information on module installation, please visit the detailed CPAN module installation guide.