summaryrefslogtreecommitdiff
path: root/lib/App/XScreenSaver/DBus/Logind.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/XScreenSaver/DBus/Logind.pm')
-rw-r--r--lib/App/XScreenSaver/DBus/Logind.pm119
1 files changed, 72 insertions, 47 deletions
diff --git a/lib/App/XScreenSaver/DBus/Logind.pm b/lib/App/XScreenSaver/DBus/Logind.pm
index 21b3fb7..45de75f 100644
--- a/lib/App/XScreenSaver/DBus/Logind.pm
+++ b/lib/App/XScreenSaver/DBus/Logind.pm
@@ -6,53 +6,24 @@ use curry;
use Net::DBus;
use IPC::Run;
use Log::Any;
-# VERSION
+our $VERSION = '1.0.5'; # VERSION
# ABSTRACT: implements the logind "inhibitor locks" and "session lock" protocols
-=head1 SYNOPSIS
-
- use Net::DBus::Reactor;
- use App::XScreenSaver::DBus::Logind;
- my $is = App::XScreenSaver::DBus::Logind->new;
- $is->start;
-
- Net::DBus::Reactor->new->run;
-
-=attr C<bus>
-
-the DBus system bus
-
-=cut
has bus => ( is => 'lazy', builder => sub { Net::DBus->system() } );
-=attr C<logind_srv>
-
-the (e)logind DBus service
-
-=cut
has logind_srv => (
is => 'lazy',
builder => sub { shift->bus->get_service('org.freedesktop.login1') },
);
-=attr C<logind_obj>
-
-the (e)logind DBus object
-
-=cut
has logind_obj => (
is => 'lazy',
builder => sub { shift->logind_srv->get_object('/org/freedesktop/login1') },
);
-=attr C<session_obj>
-
-the (e)logind session DBus object
-
-=cut
has session_obj => (
is => 'lazy',
@@ -62,29 +33,12 @@ has session_obj => (
},
);
-=attr C<inhibit_fd>
-
-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<log>
-
-a logger
-
-=cut
has log => ( is => 'lazy', builder => sub { Log::Any->get_logger } );
-=method C<start>
-
-starts listening to the C<PrepareForSleep> signal from (e)logind, and
-takes the lock
-
-=cut
sub start($self) {
$self->logind_obj->connect_to_signal(
@@ -153,3 +107,74 @@ sub _xscreensaver_command($self,$command) {
}
1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+App::XScreenSaver::DBus::Logind - implements the logind "inhibitor locks" and "session lock" protocols
+
+=head1 VERSION
+
+version 1.0.5
+
+=head1 SYNOPSIS
+
+ use Net::DBus::Reactor;
+ use App::XScreenSaver::DBus::Logind;
+ my $is = App::XScreenSaver::DBus::Logind->new;
+ $is->start;
+
+ Net::DBus::Reactor->new->run;
+
+=head1 ATTRIBUTES
+
+=head2 C<bus>
+
+the DBus system bus
+
+=head2 C<logind_srv>
+
+the (e)logind DBus service
+
+=head2 C<logind_obj>
+
+the (e)logind DBus object
+
+=head2 C<session_obj>
+
+the (e)logind session DBus object
+
+=head2 C<inhibit_fd>
+
+the file descriptor that logind gives us when we ask for a lock; we
+close it to release the lock
+
+=head2 C<log>
+
+a logger
+
+=head1 METHODS
+
+=head2 C<start>
+
+starts listening to the C<PrepareForSleep> signal from (e)logind, and
+takes the lock
+
+=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