NAME
App::FirefoxMultiAccountContainersUtils - Utilities related to Firefox Multi-Account Containers add-on
VERSION
This document describes version 0.011 of App::FirefoxMultiAccountContainersUtils (from Perl distribution App-FirefoxMultiAccountContainersUtils), released on 2020-11-02.
SYNOPSIS
DESCRIPTION
This distribution includes several utilities related to Firefox multi-account containers addon:
About the add-on: https://addons.mozilla.org/en-US/firefox/addon/multi-account-containers/.
FUNCTIONS
firefox_container
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 Containers add-on, as well as another add-on 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-ons currently do not have hooks to the CLI, is via a custom protocol handler. For example, if you want to open http://www.example.com/ in a container called mycontainer
, you ask Firefox to open this URL:
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
Usage:
firefox_mua_list_containers(%args) -> [status, msg, payload, 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) 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_modify_containers
Usage:
firefox_mua_modify_containers(%args) -> [status, msg, payload, 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) 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_sort_containers
Usage:
firefox_mua_sort_containers(%args) -> [status, msg, payload, meta]
Sort Firefox Multi-Account Containers add-on's containers.
At the time of this writing, the UI of the Firefox Multi-Account Containers add-on does not provide a way to sort the containers. Thus this utility.
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) 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)
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/App-FirefoxMultiAccountContainersUtils.
SOURCE
Source repository is at https://github.com/perlancar/perl-App-FirefoxMultiAccountContainersUtils.
BUGS
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.
SEE ALSO
"Open external links in a container" add-on, https://addons.mozilla.org/en-US/firefox/addon/open-url-in-container/ (repo at https://github.com/honsiorovskyi/open-url-in-container/). The add-on also comes with a bash launcher script: https://github.com/honsiorovskyi/open-url-in-container/blob/master/bin/launcher.sh. 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 <perlancar@cpan.org>
COPYRIGHT AND LICENSE
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.