Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- ##
- #
- # WallMorpher.rb
- # - RedTeaHacker
- #
- # I wrote this script for LXDE (specifically Lubuntu) because cortina,
- # desktop-nova, and wallch all did not work.
- # To my surprise, the Ruby process had the 2nd to last lowest CPU and memory
- # consumption in the System Monitor when testing this, so it shouldn't
- # hurt performance at all (except for a minor spike every 10 minutes).
- #
- # Usage (start up automatically):
- # - chmod +x WallMorpher.rb
- # - sudo mv WallMorpher.rb /usr/local/bin/
- # - vim ~/.config/autostart/wall-morpher.desktop:
- # [Desktop Entry]
- # Version=1.0
- # Name=Wall Morpher
- # Comment=Changes wallpaper every few minutes.
- # Exec=WallMorpher.rb
- # Terminal=true
- #
- ##
- DIR=File.expand_path('~/Pictures')
- SECS=60 * 10 # 10 minutes
- loop do
- files=Dir.glob("#{DIR}/*.*") # Inside loop so that it picks up new files
- file=files[rand(files.length)]
- system "pcmanfm --set-wallpaper '#{file}'"
- sleep SECS
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement