wallpapers 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/config.yml +1 -0
  2. data/lib/wallpaper.rb +22 -13
  3. metadata +2 -1
data/lib/config.yml ADDED
@@ -0,0 +1 @@
1
+ path: "/home/ruben/Pictures/Backgrounds"
data/lib/wallpaper.rb CHANGED
@@ -1,20 +1,29 @@
1
+ require 'yaml'
1
2
  class Wallpaper
3
+ puts File.dirname(__FILE__)
4
+ puts "Opening #{@path}"
2
5
 
3
- def initialize(path= "#{Dir.home}/Pictures/Backgrounds")
4
- @path = path
5
- puts @path
6
- end
6
+ def self.get_path
7
+ config = YAML.load_file(File.dirname(__FILE__)+"/config.yml")
8
+ @path = config["path"]
9
+ end
7
10
 
8
- def run
9
- files = Dir.entries(@path)
10
- files.each do |photo|
11
+ def self.set_path(path)
12
+ config = File.open(File.dirname(__FILE__)+"/config.yml",'w')
13
+ config.write "path: '#{path}'"
14
+ puts "Configuration file updated"
15
+ config.close
16
+ end
11
17
 
12
- system("gsettings set org.gnome.desktop.background picture-uri 'file:////#{@path}/#{photo}'")
13
- sleep(5)
14
- end
15
- end
18
+ def self.run
19
+ path = self.get_path
20
+ files = Dir.entries(path)
21
+ files.each do |photo|
22
+ system("gsettings set org.gnome.desktop.background picture-uri 'file:////#{path}/#{photo}'")
23
+ sleep(5)
24
+ end
25
+ end
16
26
 
17
27
  end
18
28
 
19
- wallpaper = Wallpaper.new
20
- wallpaper.run
29
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wallpapers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,6 +18,7 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - lib/wallpaper.rb
21
+ - lib/config.yml
21
22
  homepage: https://rubygems.org/gems/wallpapers
22
23
  licenses: []
23
24
  post_install_message: