bingwallpaper 0.6.7 → 0.6.9
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 +4 -4
- data/.ruby-version +1 -1
- data/README.md +9 -10
- data/bin/bingwallpaper +43 -35
- data/bingwallpaper.gemspec +1 -1
- data/lib/bingwallpaper/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8aed9f2468e21665442e0d8537d91d82b624316d1601359e33511e8d44078b0f
|
|
4
|
+
data.tar.gz: 23d14d63c53613d4f875fe4217496411b7871fbe47b81fc7e935b7a402796510
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2d3d51897354e23b896bd44cec8bc0e573edd5beddc388628df2d77c679d49c4c55fba6cd156a0493ba529841b20db9ac38f38b91f650e9bc7bdffa59b30d093
|
|
7
|
+
data.tar.gz: c3aea2b12293dcf6a1ee856ca3c7881a7f3f5b9478625b35585c8802351f59ae87233187d01cc9124dc1cedb9a244828195054c94f489c0442e88f6a969bd79c
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.4.
|
|
1
|
+
3.4.8
|
data/README.md
CHANGED
|
@@ -14,12 +14,9 @@ If you find this code useful in any way, please feel free to...
|
|
|
14
14
|
|
|
15
15
|
## How It Works
|
|
16
16
|
|
|
17
|
-
I wrote this script with my own environment in mind, so it's pretty
|
|
18
|
-
|
|
19
|
-
|
|
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.
|
|
17
|
+
I wrote this script with my own environment in mind, so it's pretty simple-minded. It fetches the XML describing today's image, then fetches the 1920x1200 sized version if it's available, the lower resolution version if not. Lastly, it uses [Feh][1], [swaymsg][3], [hyprpaper][5] or Gnome to set the wallpaper for your environment. I've tested it in [i3][2], [Sway][4] and Gnome 3.14.2 and nowhere else.
|
|
18
|
+
|
|
19
|
+
You can also have it download the file and return the path on standard out so that you can work it into a script of your own. 😉
|
|
23
20
|
|
|
24
21
|
## Using the Script
|
|
25
22
|
|
|
@@ -36,11 +33,12 @@ Here's the usage information...
|
|
|
36
33
|
|
|
37
34
|
```
|
|
38
35
|
Usage: bingwallpaper [options]
|
|
36
|
+
-d, --down Download only, return path to image
|
|
39
37
|
-g, --gnome Set Gnome background
|
|
40
|
-
|
|
41
|
-
-f, --
|
|
42
|
-
-s, --sway Use swaymsg to set the background, overwrite
|
|
43
|
-
|
|
38
|
+
--lock Set Gnome lock screen background
|
|
39
|
+
-f, --feh Use feh to set the background (the default)
|
|
40
|
+
-s, --sway Use swaymsg to set the background, overwrite ~/.config/sway/config.d/wallpaper
|
|
41
|
+
-l, --hypr Use Hyprpaper to set the background
|
|
44
42
|
-h, --help Prints this help
|
|
45
43
|
```
|
|
46
44
|
|
|
@@ -50,3 +48,4 @@ Usage: bingwallpaper [options]
|
|
|
50
48
|
[2]: http://i3wm.org/
|
|
51
49
|
[3]: https://github.com/swaywm/sway/blob/master/swaymsg/swaymsg.1.scd
|
|
52
50
|
[4]: https://swaywm.org/
|
|
51
|
+
[5]: https://wiki.hypr.land/Hypr-Ecosystem/hyprpaper/
|
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(
|
|
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", "--
|
|
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,15 @@ 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
|
+
|
|
49
|
+
opts.on("-x", "--script PATH_TO_SCRIPT",
|
|
50
|
+
"Invoke the provided script with the path to the image of the day") do |script|
|
|
51
|
+
options[:script] = script
|
|
52
|
+
end
|
|
53
|
+
|
|
41
54
|
opts.on("-h", "--help", "Prints this help") do
|
|
42
55
|
puts opts
|
|
43
56
|
exit
|
|
@@ -53,9 +66,7 @@ if File.exist? downloaded_data_path
|
|
|
53
66
|
|
|
54
67
|
downloaded_data = YAML.unsafe_load_file downloaded_data_path
|
|
55
68
|
if downloaded_data[:downloaded] == Date.today
|
|
56
|
-
|
|
57
69
|
logger.info "Image of the day already downloaded and set"
|
|
58
|
-
exit 0
|
|
59
70
|
end
|
|
60
71
|
end
|
|
61
72
|
|
|
@@ -95,6 +106,8 @@ begin
|
|
|
95
106
|
# fallback to the low-res image
|
|
96
107
|
if !image_path.exist? && !fallback_image_path.exist?
|
|
97
108
|
|
|
109
|
+
logger.info "Falling back to the low-resolution image..."
|
|
110
|
+
|
|
98
111
|
begin
|
|
99
112
|
|
|
100
113
|
bingImage.download_image fallback_image_path, image_data[0][:links][:fallback_url]
|
|
@@ -116,49 +129,44 @@ begin
|
|
|
116
129
|
end
|
|
117
130
|
end
|
|
118
131
|
|
|
119
|
-
|
|
132
|
+
image_path_out = nil
|
|
120
133
|
if image_path.exist?
|
|
121
|
-
|
|
122
|
-
# set the wallpaper
|
|
123
|
-
logger.info "Wallpaper set to #{image_path}"
|
|
124
|
-
|
|
125
|
-
if options[:gnome]
|
|
126
|
-
logger.info "Setting background with Gnome"
|
|
127
|
-
`gsettings set org.gnome.desktop.background picture-uri "file:///#{image_path}"`
|
|
128
|
-
elsif options[:sway]
|
|
129
|
-
logger.info "Setting background with swaymsg"
|
|
130
|
-
`swaymsg output "*" background #{image_path} fill`
|
|
131
|
-
`echo 'exec swaymsg output "*" background #{image_path} fill' > ~/.config/sway/config.d/wallpaper`
|
|
132
|
-
else
|
|
133
|
-
logger.info "Setting background with feh"
|
|
134
|
-
`feh --bg-fill #{image_path}`
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
if options[:lock]
|
|
138
|
-
logger.info "Setting lock background with Gnome"
|
|
139
|
-
`gsettings set org.gnome.desktop.screensaver picture-uri "file:///#{image_path}"`
|
|
140
|
-
end
|
|
134
|
+
image_path_out = image_path
|
|
141
135
|
elsif fallback_image_path.exist?
|
|
136
|
+
image_path_out = fallback_image_path
|
|
137
|
+
logger.info "Using the fallback, lower resolution image of the day"
|
|
138
|
+
end
|
|
139
|
+
|
|
142
140
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
logger.info "Wallpaper set to #{image_path}"
|
|
141
|
+
# set the wallpaper
|
|
142
|
+
if !image_path_out.nil?
|
|
146
143
|
|
|
147
|
-
if options[:
|
|
144
|
+
if options[:down]
|
|
145
|
+
logger.info "Returning background image path only"
|
|
146
|
+
puts(image_path_out)
|
|
147
|
+
elsif options[:gnome]
|
|
148
148
|
logger.info "Setting background with Gnome"
|
|
149
|
-
`gsettings set org.gnome.desktop.background picture-uri "file:///#{
|
|
149
|
+
`gsettings set org.gnome.desktop.background picture-uri "file:///#{image_path_out}"`
|
|
150
150
|
elsif options[:sway]
|
|
151
151
|
logger.info "Setting background with swaymsg"
|
|
152
|
-
`swaymsg output "*" background #{
|
|
153
|
-
`echo 'exec swaymsg output "*" background #{
|
|
154
|
-
|
|
152
|
+
`swaymsg output "*" background #{image_path_out} fill`
|
|
153
|
+
`echo 'exec swaymsg output "*" background #{image_path_out} fill' > ~/.config/sway/config.d/wallpaper`
|
|
154
|
+
elsif options[:hypr]
|
|
155
|
+
logger.info "Setting background with Hyprpaper"
|
|
156
|
+
`hyprctl hyprpaper reload ,#{image_path_out}`
|
|
157
|
+
elsif options[:feh]
|
|
155
158
|
logger.info "Setting background with feh"
|
|
156
|
-
`feh --bg-fill #{
|
|
159
|
+
`feh --bg-fill #{image_path_out}`
|
|
160
|
+
elsif options[:script]
|
|
161
|
+
logger.info "Invoking custom script #{options[:script]} with #{image_path_out}"
|
|
162
|
+
`#{options[:script]} #{image_path_out}`
|
|
163
|
+
else
|
|
164
|
+
logger.info "Unknown option, no background is being set"
|
|
157
165
|
end
|
|
158
166
|
|
|
159
167
|
if options[:lock]
|
|
160
168
|
logger.info "Setting lock background with Gnome"
|
|
161
|
-
`gsettings set org.gnome.desktop.screensaver picture-uri "file:///#{
|
|
169
|
+
`gsettings set org.gnome.desktop.screensaver picture-uri "file:///#{image_path_out}"`
|
|
162
170
|
end
|
|
163
171
|
else
|
|
164
172
|
|
data/bingwallpaper.gemspec
CHANGED
|
@@ -18,7 +18,7 @@ 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.
|
|
21
|
+
spec.required_ruby_version = '~> 3.4.1'
|
|
22
22
|
spec.add_dependency 'logger', '~> 1.6'
|
|
23
23
|
spec.add_dependency 'nokogiri', '~> 1.18'
|
|
24
24
|
spec.add_dependency 'OptionParser', '~> 0.5.1'
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bingwallpaper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- cmiles74
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: logger
|
|
@@ -180,14 +180,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
180
180
|
requirements:
|
|
181
181
|
- - "~>"
|
|
182
182
|
- !ruby/object:Gem::Version
|
|
183
|
-
version:
|
|
183
|
+
version: 3.4.1
|
|
184
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
185
|
requirements:
|
|
186
186
|
- - ">="
|
|
187
187
|
- !ruby/object:Gem::Version
|
|
188
188
|
version: '0'
|
|
189
189
|
requirements: []
|
|
190
|
-
rubygems_version:
|
|
190
|
+
rubygems_version: 4.0.0
|
|
191
191
|
specification_version: 4
|
|
192
192
|
summary: Sets your wallpaper to Bing's "Image of the Day"
|
|
193
193
|
test_files: []
|