blob: 648c1a6bea15838c40ed1fef2e0e9cf15ecb21b0 (
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
|
#!/usr/bin/perl
use 5.028;
use strict;
use warnings;
use lib "$ENV{HOME}/src/dotfiles/perl5";
use Local::Desktop;
use File::Copy;
my $x11 = $ENV{XDG_SESSION_TYPE} && $ENV{XDG_SESSION_TYPE} eq "x11";
# dirs where wallpaper can be found
our @dirs = ("$ENV{HOME}/annex/wallpaper/pro");
if (@ARGV and $ARGV[0] eq "--check-have") {
ensure_resize_for_current_outputs if $x11;
exit !<"$ENV{HOME}/local/wallpaper??.*">;
}
die "need --random and/or some image files" unless @ARGV;
my @wallpapers;
if ($ARGV[0] eq "--random") {
shift;
push @wallpapers, pick_random_wallpapers 4, @dirs;
}
unshift @wallpapers, @ARGV;
select_wallpaper_files @wallpapers;
if ($x11) {
resize_for_current_outputs;
system "i3-startup-always"; # feh and also restart i3lock
}
# now give develacc something
if (-e "$ENV{HOME}/local/develacc") {
my $develacc_wallpaper = @ARGV ? $ARGV[$#ARGV] : $wallpapers[$#wallpapers];
my ($ext) = $develacc_wallpaper =~ /\.([^.]+)\z/;
copy $develacc_wallpaper,
"$ENV{HOME}/local/develacc/local/wallpaper00.$ext";
}
|