Skip to content

Instantly share code, notes, and snippets.

@3ed
Last active November 18, 2016 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3ed/4b9f254fa565e820e12819e7b6577322 to your computer and use it in GitHub Desktop.
Save 3ed/4b9f254fa565e820e12819e7b6577322 to your computer and use it in GitHub Desktop.
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment