summaryrefslogtreecommitdiff
path: root/lib/App/XScreenSaver/DBus.pm
blob: 2a946779b7d23556672e94199250a3ad57475363 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package App::XScreenSaver::DBus; 
use v5.20;
use Moo;
use experimental qw(signatures postderef);
use Net::DBus::Reactor;
use Log::Any;
use App::XScreenSaver::DBus::Logind;
use App::XScreenSaver::DBus::Saver;
our $VERSION = '1.0.3'# VERSION 
# ABSTRACT: tie xscreensaver into dbus 
 
 
has reactor => (
    is => 'lazy',
    builder => sub { Net::DBus::Reactor->main() },
);
 
 
has logind => (
    is => 'lazy',
    builder => sub { App::XScreenSaver::DBus::Logind->new() },
);
 
 
has saver => (
    is => 'lazy',
    builder => sub($self) {
        App::XScreenSaver::DBus::Saver->new(reactor => $self->reactor);
    },
);
 
 
has log => ( is => 'lazy'builder => sub { Log::Any->get_logger } );
 
 
sub run($self) {
    $self->logind->start();
    $self->saver->start();
    $self->reactor->run;
}
 
1;
 
__END__
 
=pod
 
=encoding UTF-8
 
=head1 NAME
 
App::XScreenSaver::DBus - tie xscreensaver into dbus
 
=head1 VERSION
 
version 1.0.3
 
=head1 SYNOPSIS
 
    use App::XScreenSaver::DBus;
    App::XScreenSaver::DBus->new->run;
 
=head1 ATTRIBUTES
 
=head2 C<reactor>
 
the event loop
 
=head2 C<logind>
 
instance of L<< C<App::XScreenSaver::DBus::Logind> >>.
 
=head2 C<saver>
 
instance of L<< C<App::XScreenSaver::DBus::Saver> >>.
 
=head2 C<log>
 
a logger
 
=head1 METHODS
 
=head2 C<run>
 
registers the DBus services and runs the event loop; this method does
not return
 
=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