App-BrowserUtils
view release on metacpan or search on metacpan
script/pause-and-unpause-browsers view on Meta::CPAN
#!perl
# Note: This script is a CLI for Riap function /App/BrowserUtils/pause_and_unpause_browsers
# and generated automatically using Perinci::CmdLine::Gen version 0.502
use 5.010001;
use strict;
use warnings;
use Log::ger;
use Perinci::CmdLine::Any;
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2023-10-28'; # DATE
our $DIST = 'App-BrowserUtils'; # DIST
our $VERSION = '0.019'; # VERSION
my $cmdline = Perinci::CmdLine::Any->new(
url => "/App/BrowserUtils/pause_and_unpause_browsers",
program_name => "pause-and-unpause-browsers",
log => 1,
read_config => 0,
read_env => 0,
);
$cmdline->run;
# ABSTRACT: Pause and unpause browsers alternately
# PODNAME: pause-and-unpause-browsers
__END__
=pod
=encoding UTF-8
=head1 NAME
pause-and-unpause-browsers - Pause and unpause browsers alternately
=head1 VERSION
This document describes version 0.019 of pause-and-unpause-browsers (from Perl distribution App-BrowserUtils), released on 2023-10-28.
=head1 SYNOPSIS
B<pause-and-unpause-browsers> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)
B<pause-and-unpause-browsers> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)
B<pause-and-unpause-browsers> [B<L<--cmndline-pat|/"--cmndline-pat=s">>=I<L<re_from_str|Sah::Schema::re_from_str>>] [B<L<--debug|/"--debug">>|B<L<--log-level|/"--log-level=s">>=I<level>|B<L<--quiet|/"--quiet">>|B<L<--trace|/"--trace">>|B<L<--verbose|...
=head1 DESCRIPTION
A modern browser now runs complex web pages and applications. Despite browser's
power management feature, these pages/tabs on the browser often still eat
considerable CPU cycles even though they only run in the background. Pausing
(kill -STOP) the browser processes is a simple and effective way to stop CPU
eating on Unix and prolong your laptop battery life. It can be performed
whenever you are not using your browser for a little while, e.g. when you are
typing on an editor or watching a movie. When you want to use your browser
again, simply unpause (kill -CONT) it.
The C<pause-and-unpause> action pause and unpause browser in an alternate
fashion, by default every 5 minutes and 30 seconds. This is a compromise to save
CPU time most of the time but then give time for web applications in the browser
to catch up during the unpause window (e.g. for WhatsApp Web to display new
messages and sound notification.) It can be used when you are not browsing but
still want to be notified by web applications from time to time.
If you run this routine, it will start pausing and unpausing browser. When you
want to use the browser, press Ctrl-C to interrupt the routine. Then after you
are done with the browser and want to pause-and-unpause again, you can re-run
this routine.
You can customize the periods via the C<periods> option.
See also the separate C<pause_browsers> and the C<unpause_browsers> routines.
=head1 OPTIONS
C<*> marks required options.
=head2 Main options
=over
=item B<--period>=I<s@>
Pause and unpause times, in seconds.
For example, to pause for 5 minutes, then unpause 10 seconds, then pause for 2
minutes, then unpause for 30 seconds (then repeat the pattern), you can use:
300,10,120,30
Can be specified multiple times.
=item B<--periods-json>=I<s>
Pause and unpause times, in seconds (JSON-encoded).
See C<--period>.
=item B<--user>=I<s@>
Kill browser processes that belong to certain user(s) only.
Can be specified multiple times.
=item B<--users-json>=I<s>
Kill browser processes that belong to certain user(s) only (JSON-encoded).
See C<--user>.
=back
( run in 0.826 second using v1.01-cache-2.11-cpan-39bf76dae61 )