From 150599760bba4918ddfcec5da1db27dea3d63cb9 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 1 May 2021 11:18:46 +0100 Subject: Dzil-build release 1.0.0 (from 6bba3a8 on master) --- lib/App/XScreenSaver/DBus.pm | 91 ++++++++++++------- lib/App/XScreenSaver/DBus/InhibitSleep.pm | 110 ++++++++++++++--------- lib/App/XScreenSaver/DBus/Saver.pm | 144 +++++++++++++++++------------- lib/App/XScreenSaver/DBus/SaverProxy.pm | 45 ++++++++-- 4 files changed, 247 insertions(+), 143 deletions(-) (limited to 'lib/App') diff --git a/lib/App/XScreenSaver/DBus.pm b/lib/App/XScreenSaver/DBus.pm index 2ab384a..ea83093 100644 --- a/lib/App/XScreenSaver/DBus.pm +++ b/lib/App/XScreenSaver/DBus.pm @@ -6,41 +6,21 @@ use Net::DBus::Reactor; use Log::Any; use App::XScreenSaver::DBus::InhibitSleep; use App::XScreenSaver::DBus::Saver; -# VERSION +our $VERSION = '1.0.0'; # VERSION # ABSTRACT: main application class -=head1 SYNOPSIS - - use App::XScreenSaver::DBus; - App::XScreenSaver::DBus->new->run; - -=attr C - -the event loop - -=cut has reactor => ( is => 'lazy', builder => sub { Net::DBus::Reactor->main() }, ); -=attr C - -instance of L<< C >>. - -=cut has inhibit_sleep => ( is => 'lazy', builder => sub { App::XScreenSaver::DBus::InhibitSleep->new() }, ); -=attr C - -instance of L<< C >>. - -=cut has saver => ( is => 'lazy', @@ -49,20 +29,9 @@ has saver => ( }, ); -=attr C - -a logger - -=cut has log => ( is => 'lazy', builder => sub { Log::Any->get_logger } ); -=method C - -registers the DBus services and runs the event loop; this method does -not return - -=cut sub run($self) { $self->inhibit_sleep->start(); @@ -71,3 +40,61 @@ sub run($self) { } 1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +App::XScreenSaver::DBus - main application class + +=head1 VERSION + +version 1.0.0 + +=head1 SYNOPSIS + + use App::XScreenSaver::DBus; + App::XScreenSaver::DBus->new->run; + +=head1 ATTRIBUTES + +=head2 C + +the event loop + +=head2 C + +instance of L<< C >>. + +=head2 C + +instance of L<< C >>. + +=head2 C + +a logger + +=head1 METHODS + +=head2 C + +registers the DBus services and runs the event loop; this method does +not return + +=head1 AUTHOR + +Gianni Ceccarelli + +=head1 COPYRIGHT AND LICENSE + +This software is Copyright (c) 2021 by Gianni Ceccarelli . + +This is free software, licensed under: + + The GNU Affero General Public License, Version 3, November 2007 + +=cut diff --git a/lib/App/XScreenSaver/DBus/InhibitSleep.pm b/lib/App/XScreenSaver/DBus/InhibitSleep.pm index 226facf..ce980d7 100644 --- a/lib/App/XScreenSaver/DBus/InhibitSleep.pm +++ b/lib/App/XScreenSaver/DBus/InhibitSleep.pm @@ -6,71 +6,30 @@ use curry; use Net::DBus; use IPC::Run; use Log::Any; -# VERSION +our $VERSION = '1.0.0'; # VERSION # ABSTRACT: implements the logind "inhibitor locks" protocol -=head1 SYNOPSIS - - use Net::DBus::Reactor; - use App::XScreenSaver::DBus::InhibitSleep; - my $is = App::XScreenSaver::DBus::InhibitSleep->new; - $is->start; - - Net::DBus::Reactor->new->run; - -=attr C - -the DBus system bus - -=cut has bus => ( is => 'lazy', builder => sub { Net::DBus->system() } ); -=attr C - -the (e)logind DBus service - -=cut has logind_srv => ( is => 'lazy', builder => sub { shift->bus->get_service('org.freedesktop.login1') }, ); -=attr C - -the (e)logind DBus object - -=cut has logind_obj => ( is => 'lazy', builder => sub { shift->logind_srv->get_object('/org/freedesktop/login1') }, ); -=attr C - -the file descriptor that logind gives us when we ask for a lock; we -close it to release the lock - -=cut has inhibit_fd => ( is => 'rwp' ); -=attr C - -a logger - -=cut has log => ( is => 'lazy', builder => sub { Log::Any->get_logger } ); -=method C - -starts listening to the C signal from (e)logind, and -takes the lock - -=cut sub start($self) { $self->logind_obj->connect_to_signal( @@ -121,3 +80,70 @@ sub _xscreensaver_command($self,$command) { } 1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +App::XScreenSaver::DBus::InhibitSleep - implements the logind "inhibitor locks" protocol + +=head1 VERSION + +version 1.0.0 + +=head1 SYNOPSIS + + use Net::DBus::Reactor; + use App::XScreenSaver::DBus::InhibitSleep; + my $is = App::XScreenSaver::DBus::InhibitSleep->new; + $is->start; + + Net::DBus::Reactor->new->run; + +=head1 ATTRIBUTES + +=head2 C + +the DBus system bus + +=head2 C + +the (e)logind DBus service + +=head2 C + +the (e)logind DBus object + +=head2 C + +the file descriptor that logind gives us when we ask for a lock; we +close it to release the lock + +=head2 C + +a logger + +=head1 METHODS + +=head2 C + +starts listening to the C signal from (e)logind, and +takes the lock + +=head1 AUTHOR + +Gianni Ceccarelli + +=head1 COPYRIGHT AND LICENSE + +This software is Copyright (c) 2021 by Gianni Ceccarelli . + +This is free software, licensed under: + + The GNU Affero General Public License, Version 3, November 2007 + +=cut diff --git a/lib/App/XScreenSaver/DBus/Saver.pm b/lib/App/XScreenSaver/DBus/Saver.pm index 6c3e761..ea79278 100644 --- a/lib/App/XScreenSaver/DBus/Saver.pm +++ b/lib/App/XScreenSaver/DBus/Saver.pm @@ -7,63 +7,27 @@ use Log::Any; use Try::Tiny; use IPC::Run; use App::XScreenSaver::DBus::SaverProxy; -# VERSION +our $VERSION = '1.0.0'; # VERSION # ABSTRACT: implements the "idle inhibition" protocol -=head1 SYNOPSIS - - use Net::DBus::Reactor; - use App::XScreenSaver::DBus::InhibitSleep; - - my $reactor = Net::DBus::Reactor->new; - my $s = App::XScreenSaver::DBus::Saver->new(reactor => $reactor); - $s->start; - - $reactor->run; - -=attr C - -the event loop - -=cut has reactor => ( is => 'ro', required => 1 ); -=attr C - -the DBus session bus - -=cut has bus => ( is => 'lazy', builder => sub { Net::DBus->session() } ); -=attr C - -the DBus manager DBus service - -=cut has dbus_srv => ( is => 'lazy', builder => sub { shift->bus->get_service('org.freedesktop.DBus') }, ); -=attr C - -the DBus manager DBus object - -=cut has dbus_obj => ( is => 'lazy', builder => sub { shift->dbus_srv->get_object('/org/freedesktop/DBus') }, ); -=attr C - -the DBus service we export - -=cut has service => ( is => 'lazy', @@ -73,25 +37,12 @@ has service => ( }, ); -=attr C - -the paths at which we export our DBus object - -there's two of them because different applications expect this object -at different paths - -=cut has paths => ( is => 'ro', default => sub { [qw(/ScreenSaver /org/freedesktop/ScreenSaver)] }, ); -=attr C - -a logger - -=cut has log => ( is => 'lazy', builder => sub { Log::Any->get_logger } ); @@ -99,16 +50,6 @@ has _impls => ( is => 'rw' ); has _prod_id => ( is => 'rw' ); has _inhibits => ( is => 'rw', default => sub { +{} } ); -=method C - -Exports our object to the session bus, and starts listening for -C events. - -Those events are emitted when a client attaches or detaches from the -bus. A client may die before releasing the idle inhibition, so we want -to be notified when that happens, and release that inhibition. - -=cut sub start($self) { my $inhibit_cb = $self->curry::weak::_inhibit; @@ -218,3 +159,86 @@ sub _prod_screensaver($self) { } 1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +App::XScreenSaver::DBus::Saver - implements the "idle inhibition" protocol + +=head1 VERSION + +version 1.0.0 + +=head1 SYNOPSIS + + use Net::DBus::Reactor; + use App::XScreenSaver::DBus::InhibitSleep; + + my $reactor = Net::DBus::Reactor->new; + my $s = App::XScreenSaver::DBus::Saver->new(reactor => $reactor); + $s->start; + + $reactor->run; + +=head1 ATTRIBUTES + +=head2 C + +the event loop + +=head2 C + +the DBus session bus + +=head2 C + +the DBus manager DBus service + +=head2 C + +the DBus manager DBus object + +=head2 C + +the DBus service we export + +=head2 C + +the paths at which we export our DBus object + +there's two of them because different applications expect this object +at different paths + +=head2 C + +a logger + +=head1 METHODS + +=head2 C + +Exports our object to the session bus, and starts listening for +C events. + +Those events are emitted when a client attaches or detaches from the +bus. A client may die before releasing the idle inhibition, so we want +to be notified when that happens, and release that inhibition. + +=head1 AUTHOR + +Gianni Ceccarelli + +=head1 COPYRIGHT AND LICENSE + +This software is Copyright (c) 2021 by Gianni Ceccarelli . + +This is free software, licensed under: + + The GNU Affero General Public License, Version 3, November 2007 + +=cut diff --git a/lib/App/XScreenSaver/DBus/SaverProxy.pm b/lib/App/XScreenSaver/DBus/SaverProxy.pm index 858dcba..f6ed7b1 100644 --- a/lib/App/XScreenSaver/DBus/SaverProxy.pm +++ b/lib/App/XScreenSaver/DBus/SaverProxy.pm @@ -6,17 +6,9 @@ use experimental qw(signatures postderef); # this is the interface name use Net::DBus::Exporter qw(org.freedesktop.ScreenSaver); use parent 'Net::DBus::Object'; -# VERSION +our $VERSION = '1.0.0'; # VERSION # ABSTRACT: proxy dbus object -=head1 DESCRIPTION - -This is functionally the same as L<< C >>, but -specialised for this application, and with a hack to allow L<< -C >> to access the sender of the -message. - -=cut dbus_method('Inhibit',['string','string'],['uint32']); dbus_method('UnInhibit',['uint32'],[]); @@ -44,3 +36,38 @@ sub UnInhibit($self,$cookie) { } 1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +App::XScreenSaver::DBus::SaverProxy - proxy dbus object + +=head1 VERSION + +version 1.0.0 + +=head1 DESCRIPTION + +This is functionally the same as L<< C >>, but +specialised for this application, and with a hack to allow L<< +C >> to access the sender of the +message. + +=head1 AUTHOR + +Gianni Ceccarelli + +=head1 COPYRIGHT AND LICENSE + +This software is Copyright (c) 2021 by Gianni Ceccarelli . + +This is free software, licensed under: + + The GNU Affero General Public License, Version 3, November 2007 + +=cut -- cgit v1.2.3