summaryrefslogtreecommitdiff
path: root/lib/App/XScreenSaver/DBus/Saver.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/XScreenSaver/DBus/Saver.pm')
-rw-r--r--lib/App/XScreenSaver/DBus/Saver.pm144
1 files changed, 84 insertions, 60 deletions
diff --git a/lib/App/XScreenSaver/DBus/Saver.pm b/lib/App/XScreenSaver/DBus/Saver.pm
index 6eae4ed..ab6339a 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.3'; # 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<reactor>
-
-the event loop
-
-=cut
has reactor => ( is => 'ro', required => 1 );
-=attr C<bus>
-
-the DBus session bus
-
-=cut
has bus => ( is => 'lazy', builder => sub { Net::DBus->session() } );
-=attr C<dbus_srv>
-
-the DBus manager DBus service
-
-=cut
has dbus_srv => (
is => 'lazy',
builder => sub { shift->bus->get_service('org.freedesktop.DBus') },
);
-=attr C<dbus_obj>
-
-the DBus manager DBus object
-
-=cut
has dbus_obj => (
is => 'lazy',
builder => sub { shift->dbus_srv->get_object('/org/freedesktop/DBus') },
);
-=attr C<service>
-
-the DBus service we export
-
-=cut
has service => (
is => 'lazy',
@@ -73,25 +37,12 @@ has service => (
},
);
-=attr C<paths>
-
-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<log>
-
-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<start>
-
-Exports our object to the session bus, and starts listening for
-C<NameOwnerChanged> 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.3
+
+=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<reactor>
+
+the event loop
+
+=head2 C<bus>
+
+the DBus session bus
+
+=head2 C<dbus_srv>
+
+the DBus manager DBus service
+
+=head2 C<dbus_obj>
+
+the DBus manager DBus object
+
+=head2 C<service>
+
+the DBus service we export
+
+=head2 C<paths>
+
+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<log>
+
+a logger
+
+=head1 METHODS
+
+=head2 C<start>
+
+Exports our object to the session bus, and starts listening for
+C<NameOwnerChanged> 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 <dakkar@thenautilus.net>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2021 by Gianni Ceccarelli <dakkar@thenautilus.net>.
+
+This is free software, licensed under:
+
+ The GNU Affero General Public License, Version 3, November 2007
+
+=cut