Re-disable Journald, -> distrobox
This commit is contained in:
parent
00eef39441
commit
2b83934283
|
@ -40,8 +40,8 @@ are currently enabled will be set.\n
|
|||
--nocrop Don't crop a selection from the image. Instead, pass the whole
|
||||
-n image to swaybg and let it handle the scaling\n
|
||||
--verbose=N Define minimum log level. Counting from 1: LOG_DEBUG, LOG_INFO,
|
||||
-v N LOG_NOTICE, LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_ALERT, LOG_EMERG
|
||||
Default: 5; If provided without a value for N then all (1).
|
||||
-v N LOG_NOTICE, LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_ALERT, LOG_EMERG
|
||||
Default: 5; If provided without a value for N then all (1).
|
||||
--recursive=N Enumerate images recursively through directories in the path.
|
||||
-r N N indicates the directory depth, unlimited if no N is provided.
|
||||
--help This menu
|
||||
|
@ -66,7 +66,7 @@ sub new
|
|||
return bless { %args };
|
||||
}
|
||||
|
||||
$args{pidfile} = "/tmp/$ENV{USER}-wallpaper.pid";
|
||||
my $wp = new("Wallpapers");
|
||||
|
||||
if (-e $wp->{pidfile}) {
|
||||
if (-r $wp->{pidfile}) {
|
||||
|
@ -281,12 +281,12 @@ sub do_log
|
|||
# Journald is borked. Just don't bother logging
|
||||
return 0;
|
||||
if ($self->{daemon}) {
|
||||
use Log::Journald qw(send);
|
||||
send(
|
||||
PRIORITY => ERROR->{$level},
|
||||
MESSAGE => $msg,
|
||||
PERL_PACKAGE => 'Sway Wallpapers'
|
||||
) || warn "Could not send log ($level $msg): $!";
|
||||
#use Log::Journald qw(send);
|
||||
#send(
|
||||
#PRIORITY => ERROR->{$level},
|
||||
#MESSAGE => $msg,
|
||||
#PERL_PACKAGE => 'Sway Wallpapers'
|
||||
#) || warn "Could not send log ($level $msg): $!";
|
||||
if ($die) {
|
||||
$msg = '(FATAL) ' . $msg;
|
||||
exit(1);
|
||||
|
@ -374,8 +374,6 @@ sub run
|
|||
################################################################################
|
||||
# Collect arguments
|
||||
################################################################################
|
||||
|
||||
my $wp = new("Wallpapers");
|
||||
my @targets;
|
||||
my $daemon;
|
||||
my $delay;
|
||||
|
@ -383,7 +381,6 @@ my $crop;
|
|||
my $path;
|
||||
my $verbose;
|
||||
my $recursive = 0;
|
||||
|
||||
while (my $arg = shift(@ARGV)) {
|
||||
if ($arg eq '-h' || $arg eq '--help') {
|
||||
$wp->usage();
|
||||
|
@ -441,6 +438,7 @@ die "Invalid wallpaper path '$path'. Not a directory." if (defined($path) && !-d
|
|||
die "Invalid verbosity level: '$verbose'\n" if (defined($verbose) && $verbose !~ m/^[1-8]$/);
|
||||
|
||||
$wp->do_log("LOG_DEBUG", "Configuring object");
|
||||
$wp->{targets} = \@targets || undef;
|
||||
$wp->{daemon} = $daemon || 0;
|
||||
$wp->{path} = $path || "$ENV{HOME}/wallpapers";
|
||||
$wp->{crop} = $crop || 1;
|
||||
|
@ -497,28 +495,4 @@ do {
|
|||
# If we made it to here, it was not daemonized. Output errors and exit
|
||||
$wp->do_log("LOG_DEBUG", "Finishing") unless ($wp->{daemon});
|
||||
|
||||
################################################################################
|
||||
# Signals
|
||||
################################################################################
|
||||
|
||||
# SIGUSR reset the timer, force immediate reload, continue looping
|
||||
$SIG{USR1} = sub {
|
||||
alarm 0;
|
||||
$wp->do_log("LOG_INFO", "Reloading due to SIGUSR1");
|
||||
};
|
||||
|
||||
# SIGTERM reset the timer, clean pid, and allow for the main loop to finish run
|
||||
$SIG{TERM} = sub {
|
||||
$wp->do_log("LOG_INFO", "Going down clean due to SIGTERM");
|
||||
clean($wp);
|
||||
$wp->{daemon} = 0;
|
||||
};
|
||||
|
||||
# SIGKILL clean pid then exit immediately
|
||||
$SIG{KILL} = sub {
|
||||
$wp->do_log("LOG_INFO", "Hard kill with SIGKILL, attempting to remove pidfile");
|
||||
clean($wp);
|
||||
exit(0);
|
||||
};
|
||||
|
||||
exit(0);
|
||||
|
|
|
@ -5,7 +5,8 @@ Description=Rotate through cropped wallpapers for %u
|
|||
Type=forking
|
||||
PIDFile=/tmp/%u-wallpaper.pid
|
||||
WorkingDirectory=/tmp
|
||||
ExecStart=/var/home/%u/scripts/sway/wallpaper.pl -d --path=/home/jpm/wallpapers
|
||||
ExecStart=/usr/bin/distrobox enter debian12 -- "$HOME/scripts/sway/wallpaper.pl -d --path=/home/jpm/wallpapers"
|
||||
#ExecStart=/var/home/%u/scripts/sway/wallpaper.pl -d --path=/home/jpm/wallpapers
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
|
|
Loading…
Reference in New Issue