Offload wallpaper script to systemd

This commit is contained in:
John Mertz 2024-04-19 18:05:12 -06:00
parent fffbb5d5e0
commit 0cfe8d4079
1 changed files with 3 additions and 11 deletions

View File

@ -393,7 +393,7 @@ my $t = Proc::ProcessTable->new();
foreach my $p ( @{ $t->table } ) { foreach my $p ( @{ $t->table } ) {
my $cmndline = $p->{'cmndline'}; my $cmndline = $p->{'cmndline'};
$cmndline =~ s/\s*$//g; $cmndline =~ s/\s*$//g;
if ($cmndline =~ /^(waybar|wallpaper\.pl).*/) { if ($cmndline =~ /^waybar.*/) {
# Never kill this process # Never kill this process
if ($p->{'pid'} == $$) { if ($p->{'pid'} == $$) {
next; next;
@ -546,13 +546,5 @@ unless ($pid) {
`WAYLAND_DISPLAY=$waydisplay nohup $waybar_bin -b waybar0 --config=$waybar_config >> $ENV{'HOME'}/.waybar.log`; `WAYLAND_DISPLAY=$waydisplay nohup $waybar_bin -b waybar0 --config=$waybar_config >> $ENV{'HOME'}/.waybar.log`;
} }
# Start wallpapers script as fork # Restart wallpaper daemon
if ($w) { `systemctl --user restart wallpapers.service`;
$pid = fork;
unless ($pid) {
open STDIN, '/dev/null';
open STDOUT, '>>/dev/null';
open STDERR, '>>/dev/null';
`/usr/bin/perl $ENV{'HOME'}/scripts/sway/wallpaper.pl -d $w`;
}
}