-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrandom_wallpaper
More file actions
executable file
·57 lines (42 loc) · 1.6 KB
/
random_wallpaper
File metadata and controls
executable file
·57 lines (42 loc) · 1.6 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/perl -w
use strict;
use warnings;
# Set to the directory you want to have searched for photos
my $searchPath = '/home/matt/workspace/pics/xfce_wallpaper /home/matt/workspace/pics/photos/family/kids/general';
# Edit to the number of seconds between photo switches
my $switchTime = 600;
my @photos = `find $searchPath -type f | grep [jJ][pP][eE]*[gG]`;
chomp(@photos);
my $photo;
my $running = `ps -ef | grep random_wallpaper | grep perl | grep -v grep | wc -l`;
chomp($running);
# print "Running = $running\n";
# Race condition - wait for the desktop manager/window
# manager/whatever to start and be happy.
sleep(5);
# We will always get ourselves in the above count
if ($running eq "1") {
while(1)
{
$photo = $photos[rand($#photos)];
print "Photo is ${photo}\n";
# Mate
# `mateconftool-2 --type string --set /desktop/mate/background/picture_filename "$photo"`;
# Gnome
# `gconftool-2 --type string --set /desktop/gnome/background/picture_filename "$photo"`;
# general
# `xli -onroot -fullscreen "$photo"`;
# old Xfce
#`echo "# xfce backdrop list\n$photo" > ~/.config/xfce4/desktop/backdrop.list && xfdesktop --reload`;
# newer Xfce
# `echo "# xfce backdrop list\n$photo" > ~/.config/xfce4/desktop/backdrop.list && xfdesktop --reload`;
# lxde
# `pcmanfm -w ${photo}`;
# New Mate (Ubuntu Mate 20.04)
`dconf write /org/mate/desktop/background/picture-filename "'$photo'"`;
sleep($switchTime);
}
}
else {
print "Already running, exiting\n"
}