Skip to content

Instantly share code, notes, and snippets.

# set random only once and exit
perl -MPath::Tiny -MURI::file -e 'system(qw(gsettings set org.gnome.desktop.background picture-uri),URI::file->new(path(pop @{[keys %{path(".")->visit(sub{my($p,$s)=@_;$p->is_file and $p=~qr/\.(png|jpg|jpeg|svg)$/i and $s->{$p}++},{recurse =>1})}]})->absolute))'
# daemon, infinite random wallpapers, changed by every 10 secounds
perl -MPath::Tiny -MURI::file -MList::Util=shuffle -e '@a=keys %{path(".")->visit(sub{my($p,$s)=@_;$p->is_file and $p=~qr/\.(png|jpg|jpeg|svg)$/i and $s->{$p}++},{recurse =>1})};while(1){foreach(shuffle 0..$#a){system(qw(gsettings set org.gnome.desktop.background picture-uri),URI::file->new(path($a[$_])->absolute));sleep($ARGV[0])}}' 10 # secounds