bingwallpaper 0.6.5 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9b6e4e16f79f4d01c5959b5823b0861ebd7b0fcd18da4c3830436f694380392
4
- data.tar.gz: 3d3b4902fb0d9e39aaca32aa1004f8d36fe4246d83374502824572933695fc82
3
+ metadata.gz: 646a53e641cd732d58dd17b26ce1d058e27742166b16a91e31b607507e9d03f6
4
+ data.tar.gz: 9b7b309f980a062a3dfcbe0a66a8d296169880a805435c45488845e77530f695
5
5
  SHA512:
6
- metadata.gz: b2e2e75f7ae3d92a7116965af58827a9155f070446975506032b6080f3aa652e8f66eedccb50b577cce201383973e44d0b469739f30b6883f2df96b53f379520
7
- data.tar.gz: dad208d2b6bc53c5645a7db08df145be5d0a166753c3db96de89a9b4806e56ad016e6f0297074bc4d15a3222aa70f070ceabe70b57aa6600469477d9b9f88731
6
+ metadata.gz: 3be89b9d88ad40b1f5f93914a69bb10d360f95e42c769cda190a263c47743eddc047732fb7254bc86fa89d00415ae9149d51a4cc7f1fc0c62fc1f7f78a7a7380
7
+ data.tar.gz: 42cba77b44c91c251b4dd6ee96977bab507692539ec4a787a99cf81ea9dc29c2b2a0e1448508fe490b9d1f4e5a587461dd471751f6a40628e6e622271eaddd83
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.0.2
1
+ 3.4.1
data/README.md CHANGED
@@ -3,9 +3,9 @@
3
3
 
4
4
  # Bing Wallpaper
5
5
 
6
- This project provides a simple Ruby script that will download the
7
- "Image of the Day" from [Bing][0] and then sets it as your current
8
- wallpaper.
6
+ This project provides a simple Ruby script that will download the "Image of the
7
+ Day" from [Bing][0] and then sets it as your current wallpaper. There are
8
+ several tools out there that do this, this particular tool works under Linux.
9
9
 
10
10
  If you find this code useful in any way, please feel free to...
11
11
 
@@ -17,8 +17,9 @@ If you find this code useful in any way, please feel free to...
17
17
  I wrote this script with my own environment in mind, so it's pretty
18
18
  simple-minded. It fetches the XML describing today's image, then fetches the
19
19
  1920x1200 sized version if it's available, the lower resolution version if not.
20
- Lastly, it uses [Feh][1] or Gnome to set the wallpaper for your environment.
21
- I've tested it in [i3][2] and Gnome 3.14.2 and nowhere else.
20
+ Lastly, it uses [Feh][1], [swaymsg][3] or Gnome to set the wallpaper for your
21
+ environment. I've tested it in [i3][2], [Sway][4] and Gnome 3.14.2 and nowhere
22
+ else.
22
23
 
23
24
  ## Using the Script
24
25
 
@@ -26,12 +27,26 @@ Just install the gem...
26
27
 
27
28
  gem install bingwallpaper
28
29
 
29
- And then invoke the script.
30
+ And then invoke the script like so to set your wallpaper and lock screen to the
31
+ Bing Picture of the Day in Gnome.
30
32
 
31
- bingwallpaper
33
+ bingwallpaper -g -l
32
34
 
35
+ Here's the usage information...
33
36
 
34
- ***
37
+ ```
38
+ Usage: bingwallpaper [options]
39
+ -g, --gnome Set Gnome background
40
+ -l, --lock Set Gnome lock screen background
41
+ -f, --feg Use feh to set the background (the default)
42
+ -s, --sway Use swaymsg to set the background, overwrite \
43
+ ~/.config/sway/config.d/wallpaper
44
+ -h, --help Prints this help
45
+ ```
46
+
47
+ ----
35
48
  [0]: https://www.bing.com
36
49
  [1]: http://feh.finalrewind.org/
37
50
  [2]: http://i3wm.org/
51
+ [3]: https://github.com/swaywm/sway/blob/master/swaymsg/swaymsg.1.scd
52
+ [4]: https://swaywm.org/
data/bin/bingwallpaper CHANGED
@@ -11,7 +11,7 @@ require "optparse"
11
11
  require "yaml"
12
12
 
13
13
  # setup a logger
14
- logger = Logger.new(STDOUT)
14
+ logger = Logger.new(STDERR)
15
15
  logger.formatter = proc do |severity, time, progname, msg|
16
16
  "%-6s %s\n" % [severity, msg]
17
17
  end
@@ -22,6 +22,10 @@ options = {}
22
22
  OptionParser.new do |opts|
23
23
  opts.banner = "Usage: bingwallpaper [options]"
24
24
 
25
+ opts.on("-d", "--down", "Download only, return path to image") do |d|
26
+ options[:down] = d
27
+ end
28
+
25
29
  opts.on("-g", "--gnome", "Set Gnome background") do |g|
26
30
  options[:gnome] = g
27
31
  end
@@ -30,7 +34,7 @@ OptionParser.new do |opts|
30
34
  options[:lock] = g
31
35
  end
32
36
 
33
- opts.on("-f", "--feg", "Use feh to set the background (the default)") do |f|
37
+ opts.on("-f", "--feh", "Use feh to set the background (the default)") do |f|
34
38
  options[:feh] = f
35
39
  end
36
40
 
@@ -38,6 +42,10 @@ OptionParser.new do |opts|
38
42
  options[:sway] = s
39
43
  end
40
44
 
45
+ opts.on("-l", "--hypr", "Use Hyprpaper to set the background") do |l|
46
+ options[:hypr] = l
47
+ end
48
+
41
49
  opts.on("-h", "--help", "Prints this help") do
42
50
  puts opts
43
51
  exit
@@ -51,11 +59,9 @@ bingImage = Bingwallpaper::Image.new
51
59
  downloaded_data_path = bingImage.image_storage_path ".bingwallpaper"
52
60
  if File.exist? downloaded_data_path
53
61
 
54
- downloaded_data = YAML.load_file downloaded_data_path
62
+ downloaded_data = YAML.unsafe_load_file downloaded_data_path
55
63
  if downloaded_data[:downloaded] == Date.today
56
-
57
64
  logger.info "Image of the day already downloaded and set"
58
- exit 0
59
65
  end
60
66
  end
61
67
 
@@ -95,6 +101,8 @@ begin
95
101
  # fallback to the low-res image
96
102
  if !image_path.exist? && !fallback_image_path.exist?
97
103
 
104
+ logger.info "Falling back to the low-resolution image..."
105
+
98
106
  begin
99
107
 
100
108
  bingImage.download_image fallback_image_path, image_data[0][:links][:fallback_url]
@@ -111,27 +119,32 @@ begin
111
119
 
112
120
  # update our downloaded data
113
121
  if downloaded_data
114
- File.open(downloaded_data_path, "w+") do |file_out|
115
- file_out.write downloaded_data.to_yaml
122
+ File.open(downloaded_data_path, "w+") do |file_out|
123
+ file_out.write YAML.dump(downloaded_data)
116
124
  end
117
125
  end
118
126
 
119
127
  # set the wallpaper
120
128
  if image_path.exist?
121
129
 
122
- # set the wallpaper
123
- logger.info "Wallpaper set to #{image_path}"
124
-
125
- if options[:gnome]
130
+ if options[:down]
131
+ logger.info "Returning background image path only"
132
+ puts(image_path)
133
+ elsif options[:gnome]
126
134
  logger.info "Setting background with Gnome"
127
135
  `gsettings set org.gnome.desktop.background picture-uri "file:///#{image_path}"`
128
136
  elsif options[:sway]
129
137
  logger.info "Setting background with swaymsg"
130
138
  `swaymsg output "*" background #{image_path} fill`
131
139
  `echo 'exec swaymsg output "*" background #{image_path} fill' > ~/.config/sway/config.d/wallpaper`
132
- else
140
+ elsif options[:hypr]
141
+ logger.info "Setting background with Hyprpaper"
142
+ `hyprctl hyprpaper reload ,#{image_path}`
143
+ elsif options[:feh]
133
144
  logger.info "Setting background with feh"
134
145
  `feh --bg-fill #{image_path}`
146
+ else
147
+ logger.info "Unknown option, no background is being set"
135
148
  end
136
149
 
137
150
  if options[:lock]
@@ -140,20 +153,24 @@ begin
140
153
  end
141
154
  elsif fallback_image_path.exist?
142
155
 
143
- # set the wallpaper
144
- logger.info "Only the low-resolution image was available today."
145
- logger.info "Wallpaper set to #{image_path}"
146
-
147
- if options[:gnome]
156
+ if options[:down]
157
+ logger.info "Returning background image path only"
158
+ puts(fallback_image_path)
159
+ elsif options[:gnome]
148
160
  logger.info "Setting background with Gnome"
149
161
  `gsettings set org.gnome.desktop.background picture-uri "file:///#{fallback_image_path}"`
150
162
  elsif options[:sway]
151
163
  logger.info "Setting background with swaymsg"
152
164
  `swaymsg output "*" background #{fallback_image_path} fill`
153
165
  `echo 'exec swaymsg output "*" background #{fallback_image_path} fill' > ~/.config/sway/config.d/wallpaper`
154
- else
166
+ elsif options[:hypr]
167
+ logger.info "Setting background with Hyprpaper"
168
+ `hyprctl hyprpaper reload ,#{fallback_image_path}`
169
+ elsif options[:feh]
155
170
  logger.info "Setting background with feh"
156
171
  `feh --bg-fill #{fallback_image_path}`
172
+ else
173
+ logger.info "Unknown option, no background is being set"
157
174
  end
158
175
 
159
176
  if options[:lock]
@@ -18,14 +18,15 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.required_ruby_version = '~> 3.0'
22
- spec.add_dependency "nokogiri", "~> 1.12.4"
23
- spec.add_dependency "OptionParser", "~> 0.5.1"
24
- spec.add_development_dependency "bundler", "~> 2.2.27"
25
- spec.add_development_dependency "irb", "~> 1.3.7"
26
- spec.add_development_dependency "rake", "~> 13.0.6"
27
- spec.add_development_dependency "pry", "~> 0.10"
28
- spec.add_development_dependency "pry-doc", "~> 0.6.0"
29
- spec.add_development_dependency "method_source", "~> 1.0"
30
- spec.add_development_dependency "webrick", "~> 1.5.0"
21
+ spec.required_ruby_version = '~> 3.2'
22
+ spec.add_dependency 'logger', '~> 1.6'
23
+ spec.add_dependency 'nokogiri', '~> 1.18'
24
+ spec.add_dependency 'OptionParser', '~> 0.5.1'
25
+ spec.add_development_dependency 'bundler', '~> 2.5'
26
+ spec.add_development_dependency 'rake', '~> 13.2'
27
+ spec.add_development_dependency 'pry', '~> 0.15'
28
+ spec.add_development_dependency 'pry-doc', '~> 1.5'
29
+ spec.add_development_dependency 'method_source', '~> 1.0'
30
+ spec.add_development_dependency 'irb', '~> 1.14.3'
31
+ spec.add_development_dependency 'ostruct', '~> 0.6.1'
31
32
  end
@@ -58,7 +58,7 @@ module Bingwallpaper
58
58
 
59
59
  # Constructs a full path for the provided partial URL.
60
60
  #
61
- # partial:: the end of the target URL
61
+ # partial:: the end of the target URLm
62
62
  def build_url(partial)
63
63
 
64
64
  return PROTO + DOMAIN + partial
@@ -1,3 +1,3 @@
1
1
  module Bingwallpaper
2
- VERSION ||= "0.6.5"
2
+ VERSION ||= "0.6.8"
3
3
  end
metadata CHANGED
@@ -1,113 +1,112 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bingwallpaper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - cmiles74
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2021-09-07 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: nokogiri
13
+ name: logger
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: 1.12.4
18
+ version: '1.6'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: 1.12.4
25
+ version: '1.6'
27
26
  - !ruby/object:Gem::Dependency
28
- name: OptionParser
27
+ name: nokogiri
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: 0.5.1
32
+ version: '1.18'
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
- version: 0.5.1
39
+ version: '1.18'
41
40
  - !ruby/object:Gem::Dependency
42
- name: bundler
41
+ name: OptionParser
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
44
  - - "~>"
46
45
  - !ruby/object:Gem::Version
47
- version: 2.2.27
48
- type: :development
46
+ version: 0.5.1
47
+ type: :runtime
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
51
  - - "~>"
53
52
  - !ruby/object:Gem::Version
54
- version: 2.2.27
53
+ version: 0.5.1
55
54
  - !ruby/object:Gem::Dependency
56
- name: irb
55
+ name: bundler
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
58
  - - "~>"
60
59
  - !ruby/object:Gem::Version
61
- version: 1.3.7
60
+ version: '2.5'
62
61
  type: :development
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
65
  - - "~>"
67
66
  - !ruby/object:Gem::Version
68
- version: 1.3.7
67
+ version: '2.5'
69
68
  - !ruby/object:Gem::Dependency
70
69
  name: rake
71
70
  requirement: !ruby/object:Gem::Requirement
72
71
  requirements:
73
72
  - - "~>"
74
73
  - !ruby/object:Gem::Version
75
- version: 13.0.6
74
+ version: '13.2'
76
75
  type: :development
77
76
  prerelease: false
78
77
  version_requirements: !ruby/object:Gem::Requirement
79
78
  requirements:
80
79
  - - "~>"
81
80
  - !ruby/object:Gem::Version
82
- version: 13.0.6
81
+ version: '13.2'
83
82
  - !ruby/object:Gem::Dependency
84
83
  name: pry
85
84
  requirement: !ruby/object:Gem::Requirement
86
85
  requirements:
87
86
  - - "~>"
88
87
  - !ruby/object:Gem::Version
89
- version: '0.10'
88
+ version: '0.15'
90
89
  type: :development
91
90
  prerelease: false
92
91
  version_requirements: !ruby/object:Gem::Requirement
93
92
  requirements:
94
93
  - - "~>"
95
94
  - !ruby/object:Gem::Version
96
- version: '0.10'
95
+ version: '0.15'
97
96
  - !ruby/object:Gem::Dependency
98
97
  name: pry-doc
99
98
  requirement: !ruby/object:Gem::Requirement
100
99
  requirements:
101
100
  - - "~>"
102
101
  - !ruby/object:Gem::Version
103
- version: 0.6.0
102
+ version: '1.5'
104
103
  type: :development
105
104
  prerelease: false
106
105
  version_requirements: !ruby/object:Gem::Requirement
107
106
  requirements:
108
107
  - - "~>"
109
108
  - !ruby/object:Gem::Version
110
- version: 0.6.0
109
+ version: '1.5'
111
110
  - !ruby/object:Gem::Dependency
112
111
  name: method_source
113
112
  requirement: !ruby/object:Gem::Requirement
@@ -123,19 +122,33 @@ dependencies:
123
122
  - !ruby/object:Gem::Version
124
123
  version: '1.0'
125
124
  - !ruby/object:Gem::Dependency
126
- name: webrick
125
+ name: irb
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: 1.14.3
131
+ type: :development
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: 1.14.3
138
+ - !ruby/object:Gem::Dependency
139
+ name: ostruct
127
140
  requirement: !ruby/object:Gem::Requirement
128
141
  requirements:
129
142
  - - "~>"
130
143
  - !ruby/object:Gem::Version
131
- version: 1.5.0
144
+ version: 0.6.1
132
145
  type: :development
133
146
  prerelease: false
134
147
  version_requirements: !ruby/object:Gem::Requirement
135
148
  requirements:
136
149
  - - "~>"
137
150
  - !ruby/object:Gem::Version
138
- version: 1.5.0
151
+ version: 0.6.1
139
152
  description: This script downloads the "Image of the Day" and then uses Feh or Gnome
140
153
  to set your desktop wallpaper. More information available at https://github.com/cmiles74/bingwallpaper/.
141
154
  email:
@@ -160,7 +173,6 @@ homepage: https://github.com/cmiles74/bingwallpaper
160
173
  licenses:
161
174
  - MIT
162
175
  metadata: {}
163
- post_install_message:
164
176
  rdoc_options: []
165
177
  require_paths:
166
178
  - lib
@@ -168,15 +180,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
168
180
  requirements:
169
181
  - - "~>"
170
182
  - !ruby/object:Gem::Version
171
- version: '3.0'
183
+ version: '3.2'
172
184
  required_rubygems_version: !ruby/object:Gem::Requirement
173
185
  requirements:
174
186
  - - ">="
175
187
  - !ruby/object:Gem::Version
176
188
  version: '0'
177
189
  requirements: []
178
- rubygems_version: 3.2.3
179
- signing_key:
190
+ rubygems_version: 3.7.2
180
191
  specification_version: 4
181
192
  summary: Sets your wallpaper to Bing's "Image of the Day"
182
193
  test_files: []