summaryrefslogtreecommitdiff
path: root/lib/App/XScreenSaver/DBus.pm
blob: 10c87fd6e7ffa36fe8fd3d6dfb816a1816be9955 (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
package App::XScreenSaver::DBus; 
use Moo;
use experimental 'signatures';
use Net::DBus::Reactor;
use App::XScreenSaver::DBus::InhibitSleep;
use App::XScreenSaver::DBus::Saver;
 
has reactor => (
    is => 'lazy',
    builder => sub { Net::DBus::Reactor->main() },
);
 
has inhibit_sleep => (
    is => 'lazy',
    builder => sub { App::XScreenSaver::DBus::InhibitSleep->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->inhibit_sleep->start();
    $self->saver->start();
    $self->reactor->run;
}
 
1;