App-XScreenSaver-DBus

 view release on metacpan or  search on metacpan

lib/App/XScreenSaver/DBus/Logind.pm  view on Meta::CPAN

use Log::Any;
our $VERSION = '1.0.6'; # VERSION
# ABSTRACT: implements the logind "inhibitor locks" and "session lock" protocols


has bus => ( is => 'lazy', builder => sub { Net::DBus->system() } );


has logind_srv => (
    is => 'lazy',
    builder => sub { shift->bus->get_service('org.freedesktop.login1') },
);


has logind_obj => (
    is => 'lazy',
    builder => sub { shift->logind_srv->get_object('/org/freedesktop/login1') },
);


has session_obj => (
    is => 'lazy',
    builder => sub($self) {
        my $session_path = $self->logind_obj->GetSessionByPID($$);
        return $self->logind_srv->get_object($session_path);
    },
);

lib/App/XScreenSaver/DBus/Saver.pm  view on Meta::CPAN



has reactor => ( is => 'ro', required => 1 );


has bus => ( is => 'lazy', builder => sub { Net::DBus->session() } );


has dbus_srv => (
    is => 'lazy',
    builder => sub { shift->bus->get_service('org.freedesktop.DBus') },
);


has dbus_obj => (
    is => 'lazy',
    builder => sub { shift->dbus_srv->get_object('/org/freedesktop/DBus') },
);


has service => (
    is => 'lazy',
    builder => sub {
        # this is the service name
        shift->bus->export_service('org.freedesktop.ScreenSaver');
    },
);


has paths => (
    is => 'ro',
    default => sub { [qw(/ScreenSaver /org/freedesktop/ScreenSaver)] },
);


has log => ( is => 'lazy', builder => sub { Log::Any->get_logger } );

has _proxies => ( is => 'rw' );
has _prod_id => ( is => 'rw' );
has _inhibits => ( is => 'rw', default => sub { +{} } );


lib/App/XScreenSaver/DBus/SaverProxy.pm  view on Meta::CPAN

package App::XScreenSaver::DBus::SaverProxy;
use v5.20;
use strict;
use warnings;
# this is the interface name
use Net::DBus::Exporter qw(org.freedesktop.ScreenSaver);
use parent 'Net::DBus::ProxyObject';
our $VERSION = '1.0.6'; # VERSION
# ABSTRACT: proxy dbus object

dbus_method('Inhibit',['string','string','caller'],['uint32']);
dbus_method('UnInhibit',['uint32','caller'],[]);

1;

__END__

scripts/xscreensaver-dbus  view on Meta::CPAN

    xscreensaver &
    xscreensaver-dbus > ~/xscreensaver-dbus.log &

=head1 DESCRIPTION

This program will ensure that xscreensaver locks the screen before
your laptop goes to sleep, and will prevent the screen saver from
running while video is playing.

It does so by implementing L<the "idle inhibition" DBus
service|https://people.freedesktop.org/~hadess/idle-inhibition-spec/index.html>
and using L<the "inhibitor locks" feature of
logind|https://www.freedesktop.org/wiki/Software/systemd/inhibit/>.

=head1 WHY?

If you use xscreensaver, you may have noticed that it doesn't
integrate very well with all the new & fancy desktop features.

jwz has resisted adding this kind of integration to the base program,
saying (sensibly) that they would bloat the code and introduce
potential security holes.

From version 5.43, xscreensaver includes F<xscreensaver-systemd>, a
stripped-down version of L<a program initially developed by Martin
Lucina|https://github.com/mato/xscreensaver-systemd>, which handles
the logind interaction. Both of those versions link to F<libsystemd>,
which you may not have if you use elogind instead of the full systemd.

scripts/xscreensaver-dbus  view on Meta::CPAN

=item *

L<the Debian bug where the above program is first mentioned|https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=781961>

=item *

L<"Is there a decent way to inhibit screensavers in linux?" on StackOverflow|https://stackoverflow.com/questions/460140/is-there-a-decent-way-to-inhibit-screensavers-in-linux>

=item *

L<the systemd "Inhibitor Locks" documentation|https://www.freedesktop.org/wiki/Software/systemd/inhibit/>

=item *

L<the "idle inhibition" spec|https://people.freedesktop.org/~hadess/idle-inhibition-spec/index.html>

=back

=head1 AUTHOR

Gianni Ceccarelli <dakkar@thenautilus.net>

=head1 COPYRIGHT AND LICENSE

This software is Copyright (c) 2021 by Gianni Ceccarelli <dakkar@thenautilus.net>.



( run in 0.461 second using v1.01-cache-2.11-cpan-299005ec8e3 )