├── .github └── workflows │ ├── on_push.yml │ └── release.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── config file examples └── config.toml ├── demo.gif ├── dyn-wall-rs.service ├── scripts └── swaybg-dyn.sh └── src ├── config.rs ├── errors.rs ├── lib.rs ├── main.rs └── time_track.rs /.github/workflows/on_push.yml: -------------------------------------------------------------------------------- 1 | name: Test and build dyn-wall-rs for Linux and Windows 2 | on: push 3 | 4 | jobs: 5 | test: 6 | runs-on: ${{ matrix.os }} 7 | strategy: 8 | matrix: 9 | os: [ubuntu-latest, windows-latest] 10 | 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: Run tests 14 | run: cargo test --verbose 15 | 16 | release-linux: 17 | needs: test 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/checkout@v2 21 | 22 | - name: Build 23 | run: cargo build --release 24 | 25 | - name: Copy binary over 26 | run: cp target/release/dyn-wall-rs . 27 | 28 | - name: Pack into tarball 29 | run: tar -czvf dyn-wall-rs-linux.tar.gz dyn-wall-rs 30 | 31 | - name: Find sha265sum 32 | run: sha256sum dyn-wall-rs-linux.tar.gz > dyn-wall-rs-linux.sha256 33 | 34 | - name: Upload Linux assets 35 | uses: actions/upload-artifact@v2 36 | with: 37 | name: assets-linux 38 | path: dyn-wall-rs-linux* 39 | 40 | release-windows: 41 | needs: test 42 | runs-on: windows-latest 43 | steps: 44 | - uses: actions/checkout@v2 45 | 46 | - name: Build 47 | run: cargo build --release 48 | 49 | - name: Copy .exe over 50 | run: Copy-Item -Path target\release\dyn-wall-rs.exe 51 | 52 | - name: zip .exe 53 | run: tar.exe -a -cf dyn-wall-rs-windows.zip dyn-wall-rs.exe 54 | 55 | - name: Find sha265sum 56 | run: Get-FileHash dyn-wall-rs-windows.zip -Algorithm SHA256 | Format-List > dyn-wall-rs-windows.sha256 57 | 58 | - name: Upload Linux assets 59 | uses: actions/upload-artifact@v2 60 | with: 61 | name: assets-windows 62 | path: dyn-wall-rs-windows* 63 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Test and build dyn-wall-rs for Linux and Windows 2 | on: 3 | push: 4 | tags: 5 | - "v*" 6 | 7 | jobs: 8 | test: 9 | runs-on: ${{ matrix.os }} 10 | strategy: 11 | matrix: 12 | os: [ubuntu-latest, windows-latest] 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Run tests 17 | run: cargo test --verbose 18 | 19 | release-linux: 20 | needs: test 21 | runs-on: ubuntu-latest 22 | steps: 23 | - uses: actions/checkout@v2 24 | 25 | - name: Build 26 | run: cargo build --release 27 | 28 | - name: Copy binary over 29 | run: cp target/release/dyn-wall-rs . 30 | 31 | - name: Pack into tarball 32 | run: tar -czvf dyn-wall-rs-linux.tar.gz dyn-wall-rs 33 | 34 | - name: Find sha265sum 35 | run: sha256sum dyn-wall-rs-linux.tar.gz > dyn-wall-rs-linux.sha256 36 | 37 | - name: Create Release 38 | id: create_release 39 | uses: actions/create-release@v1 40 | env: 41 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 42 | with: 43 | tag_name: ${{ github.ref }} 44 | release_name: ${{ github.ref }} 45 | draft: false 46 | prerelease: false 47 | 48 | - name: Upload Linux zip 49 | id: upload-linux-zip 50 | uses: actions/upload-release-asset@v1 51 | env: 52 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 53 | 54 | with: 55 | upload_url: ${{ steps.create_release.outputs.upload_url }} 56 | asset_path: dyn-wall-rs-linux.tar.gz 57 | asset_name: dyn-wall-rs-linux.tar.gz 58 | asset_content_type: application/zip 59 | 60 | - name: Upload Linux sha256 61 | id: upload-linux-sha256 62 | uses: actions/upload-release-asset@v1 63 | env: 64 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 65 | 66 | with: 67 | upload_url: ${{ steps.create_release.outputs.upload_url }} 68 | asset_path: dyn-wall-rs-linux.sha256 69 | asset_name: dyn-wall-rs-linux.sha256 70 | asset_content_type: application/zip 71 | 72 | release-windows: 73 | needs: test 74 | runs-on: windows-latest 75 | steps: 76 | - uses: actions/checkout@v2 77 | 78 | - name: Build 79 | run: cargo build --release 80 | 81 | - name: Copy .exe over 82 | run: Copy-Item -Path target\release\dyn-wall-rs.exe 83 | 84 | - name: zip .exe 85 | run: tar.exe -a -cf dyn-wall-rs-windows.zip dyn-wall-rs.exe 86 | 87 | - name: Find sha265sum 88 | run: Get-FileHash dyn-wall-rs-windows.zip -Algorithm SHA256 | Format-List > dyn-wall-rs-windows.sha256 89 | 90 | - name: Get the version 91 | id: get_version 92 | shell: bash 93 | run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} 94 | 95 | - uses: AButler/upload-release-assets@v2.0 96 | with: 97 | files: 'dyn-wall-rs-windows.zip;dyn-wall-rs-windows.sha256' 98 | repo-token: ${{ secrets.GITHUB_TOKEN }} 99 | release-tag: ${{ steps.get_version.outputs.VERSION }} 100 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /.idea 3 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "alphanumeric-sort" 7 | version = "1.4.4" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "77e9c9abb82613923ec78d7a461595d52491ba7240f3c64c0bbe0e6d98e0fce0" 10 | 11 | [[package]] 12 | name = "android_system_properties" 13 | version = "0.1.5" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" 16 | dependencies = [ 17 | "libc", 18 | ] 19 | 20 | [[package]] 21 | name = "autocfg" 22 | version = "1.1.0" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 25 | 26 | [[package]] 27 | name = "bitflags" 28 | version = "1.3.2" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 31 | 32 | [[package]] 33 | name = "bumpalo" 34 | version = "3.12.0" 35 | source = "registry+https://github.com/rust-lang/crates.io-index" 36 | checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" 37 | 38 | [[package]] 39 | name = "cc" 40 | version = "1.0.79" 41 | source = "registry+https://github.com/rust-lang/crates.io-index" 42 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 43 | 44 | [[package]] 45 | name = "cfg-if" 46 | version = "1.0.0" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 49 | 50 | [[package]] 51 | name = "chrono" 52 | version = "0.4.23" 53 | source = "registry+https://github.com/rust-lang/crates.io-index" 54 | checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" 55 | dependencies = [ 56 | "iana-time-zone", 57 | "js-sys", 58 | "num-integer", 59 | "num-traits", 60 | "time", 61 | "wasm-bindgen", 62 | "winapi", 63 | ] 64 | 65 | [[package]] 66 | name = "clap" 67 | version = "4.1.4" 68 | source = "registry+https://github.com/rust-lang/crates.io-index" 69 | checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" 70 | dependencies = [ 71 | "bitflags", 72 | "clap_derive", 73 | "clap_lex", 74 | "is-terminal", 75 | "once_cell", 76 | "strsim", 77 | "termcolor", 78 | ] 79 | 80 | [[package]] 81 | name = "clap_derive" 82 | version = "4.1.0" 83 | source = "registry+https://github.com/rust-lang/crates.io-index" 84 | checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" 85 | dependencies = [ 86 | "heck", 87 | "proc-macro-error", 88 | "proc-macro2", 89 | "quote", 90 | "syn", 91 | ] 92 | 93 | [[package]] 94 | name = "clap_lex" 95 | version = "0.3.1" 96 | source = "registry+https://github.com/rust-lang/crates.io-index" 97 | checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" 98 | dependencies = [ 99 | "os_str_bytes", 100 | ] 101 | 102 | [[package]] 103 | name = "clokwerk" 104 | version = "0.4.0" 105 | source = "registry+https://github.com/rust-lang/crates.io-index" 106 | checksum = "bd108d365fcb6d7eddf17a6718eb6a33db18ba4178f8cc6b667f480710f10d76" 107 | dependencies = [ 108 | "chrono", 109 | ] 110 | 111 | [[package]] 112 | name = "codespan-reporting" 113 | version = "0.11.1" 114 | source = "registry+https://github.com/rust-lang/crates.io-index" 115 | checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" 116 | dependencies = [ 117 | "termcolor", 118 | "unicode-width", 119 | ] 120 | 121 | [[package]] 122 | name = "core-foundation-sys" 123 | version = "0.8.3" 124 | source = "registry+https://github.com/rust-lang/crates.io-index" 125 | checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" 126 | 127 | [[package]] 128 | name = "cxx" 129 | version = "1.0.89" 130 | source = "registry+https://github.com/rust-lang/crates.io-index" 131 | checksum = "bc831ee6a32dd495436e317595e639a587aa9907bef96fe6e6abc290ab6204e9" 132 | dependencies = [ 133 | "cc", 134 | "cxxbridge-flags", 135 | "cxxbridge-macro", 136 | "link-cplusplus", 137 | ] 138 | 139 | [[package]] 140 | name = "cxx-build" 141 | version = "1.0.89" 142 | source = "registry+https://github.com/rust-lang/crates.io-index" 143 | checksum = "94331d54f1b1a8895cd81049f7eaaaef9d05a7dcb4d1fd08bf3ff0806246789d" 144 | dependencies = [ 145 | "cc", 146 | "codespan-reporting", 147 | "once_cell", 148 | "proc-macro2", 149 | "quote", 150 | "scratch", 151 | "syn", 152 | ] 153 | 154 | [[package]] 155 | name = "cxxbridge-flags" 156 | version = "1.0.89" 157 | source = "registry+https://github.com/rust-lang/crates.io-index" 158 | checksum = "48dcd35ba14ca9b40d6e4b4b39961f23d835dbb8eed74565ded361d93e1feb8a" 159 | 160 | [[package]] 161 | name = "cxxbridge-macro" 162 | version = "1.0.89" 163 | source = "registry+https://github.com/rust-lang/crates.io-index" 164 | checksum = "81bbeb29798b407ccd82a3324ade1a7286e0d29851475990b612670f6f5124d2" 165 | dependencies = [ 166 | "proc-macro2", 167 | "quote", 168 | "syn", 169 | ] 170 | 171 | [[package]] 172 | name = "dirs-next" 173 | version = "2.0.0" 174 | source = "registry+https://github.com/rust-lang/crates.io-index" 175 | checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" 176 | dependencies = [ 177 | "cfg-if", 178 | "dirs-sys-next", 179 | ] 180 | 181 | [[package]] 182 | name = "dirs-sys-next" 183 | version = "0.1.2" 184 | source = "registry+https://github.com/rust-lang/crates.io-index" 185 | checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" 186 | dependencies = [ 187 | "libc", 188 | "redox_users", 189 | "winapi", 190 | ] 191 | 192 | [[package]] 193 | name = "dunce" 194 | version = "1.0.3" 195 | source = "registry+https://github.com/rust-lang/crates.io-index" 196 | checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c" 197 | 198 | [[package]] 199 | name = "dyn-wall-rs" 200 | version = "2.1.3" 201 | dependencies = [ 202 | "alphanumeric-sort", 203 | "chrono", 204 | "clap", 205 | "clokwerk", 206 | "dirs-next", 207 | "rand", 208 | "run_script", 209 | "serde", 210 | "sun-times", 211 | "toml", 212 | "unicase", 213 | "walkdir", 214 | "winapi", 215 | ] 216 | 217 | [[package]] 218 | name = "errno" 219 | version = "0.2.8" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" 222 | dependencies = [ 223 | "errno-dragonfly", 224 | "libc", 225 | "winapi", 226 | ] 227 | 228 | [[package]] 229 | name = "errno-dragonfly" 230 | version = "0.1.2" 231 | source = "registry+https://github.com/rust-lang/crates.io-index" 232 | checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" 233 | dependencies = [ 234 | "cc", 235 | "libc", 236 | ] 237 | 238 | [[package]] 239 | name = "fsio" 240 | version = "0.4.0" 241 | source = "registry+https://github.com/rust-lang/crates.io-index" 242 | checksum = "dad0ce30be0cc441b325c5d705c8b613a0ca0d92b6a8953d41bd236dc09a36d0" 243 | dependencies = [ 244 | "dunce", 245 | "rand", 246 | ] 247 | 248 | [[package]] 249 | name = "getrandom" 250 | version = "0.2.8" 251 | source = "registry+https://github.com/rust-lang/crates.io-index" 252 | checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" 253 | dependencies = [ 254 | "cfg-if", 255 | "libc", 256 | "wasi 0.11.0+wasi-snapshot-preview1", 257 | ] 258 | 259 | [[package]] 260 | name = "hashbrown" 261 | version = "0.12.3" 262 | source = "registry+https://github.com/rust-lang/crates.io-index" 263 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 264 | 265 | [[package]] 266 | name = "heck" 267 | version = "0.4.1" 268 | source = "registry+https://github.com/rust-lang/crates.io-index" 269 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 270 | 271 | [[package]] 272 | name = "hermit-abi" 273 | version = "0.3.1" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" 276 | 277 | [[package]] 278 | name = "iana-time-zone" 279 | version = "0.1.53" 280 | source = "registry+https://github.com/rust-lang/crates.io-index" 281 | checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" 282 | dependencies = [ 283 | "android_system_properties", 284 | "core-foundation-sys", 285 | "iana-time-zone-haiku", 286 | "js-sys", 287 | "wasm-bindgen", 288 | "winapi", 289 | ] 290 | 291 | [[package]] 292 | name = "iana-time-zone-haiku" 293 | version = "0.1.1" 294 | source = "registry+https://github.com/rust-lang/crates.io-index" 295 | checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" 296 | dependencies = [ 297 | "cxx", 298 | "cxx-build", 299 | ] 300 | 301 | [[package]] 302 | name = "indexmap" 303 | version = "1.9.2" 304 | source = "registry+https://github.com/rust-lang/crates.io-index" 305 | checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" 306 | dependencies = [ 307 | "autocfg", 308 | "hashbrown", 309 | ] 310 | 311 | [[package]] 312 | name = "io-lifetimes" 313 | version = "1.0.5" 314 | source = "registry+https://github.com/rust-lang/crates.io-index" 315 | checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" 316 | dependencies = [ 317 | "libc", 318 | "windows-sys", 319 | ] 320 | 321 | [[package]] 322 | name = "is-terminal" 323 | version = "0.4.3" 324 | source = "registry+https://github.com/rust-lang/crates.io-index" 325 | checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" 326 | dependencies = [ 327 | "hermit-abi", 328 | "io-lifetimes", 329 | "rustix", 330 | "windows-sys", 331 | ] 332 | 333 | [[package]] 334 | name = "js-sys" 335 | version = "0.3.61" 336 | source = "registry+https://github.com/rust-lang/crates.io-index" 337 | checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" 338 | dependencies = [ 339 | "wasm-bindgen", 340 | ] 341 | 342 | [[package]] 343 | name = "libc" 344 | version = "0.2.139" 345 | source = "registry+https://github.com/rust-lang/crates.io-index" 346 | checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" 347 | 348 | [[package]] 349 | name = "link-cplusplus" 350 | version = "1.0.8" 351 | source = "registry+https://github.com/rust-lang/crates.io-index" 352 | checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" 353 | dependencies = [ 354 | "cc", 355 | ] 356 | 357 | [[package]] 358 | name = "linux-raw-sys" 359 | version = "0.1.4" 360 | source = "registry+https://github.com/rust-lang/crates.io-index" 361 | checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" 362 | 363 | [[package]] 364 | name = "log" 365 | version = "0.4.17" 366 | source = "registry+https://github.com/rust-lang/crates.io-index" 367 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 368 | dependencies = [ 369 | "cfg-if", 370 | ] 371 | 372 | [[package]] 373 | name = "memchr" 374 | version = "2.5.0" 375 | source = "registry+https://github.com/rust-lang/crates.io-index" 376 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 377 | 378 | [[package]] 379 | name = "nom8" 380 | version = "0.2.0" 381 | source = "registry+https://github.com/rust-lang/crates.io-index" 382 | checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" 383 | dependencies = [ 384 | "memchr", 385 | ] 386 | 387 | [[package]] 388 | name = "num-integer" 389 | version = "0.1.45" 390 | source = "registry+https://github.com/rust-lang/crates.io-index" 391 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 392 | dependencies = [ 393 | "autocfg", 394 | "num-traits", 395 | ] 396 | 397 | [[package]] 398 | name = "num-traits" 399 | version = "0.2.15" 400 | source = "registry+https://github.com/rust-lang/crates.io-index" 401 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 402 | dependencies = [ 403 | "autocfg", 404 | ] 405 | 406 | [[package]] 407 | name = "once_cell" 408 | version = "1.17.0" 409 | source = "registry+https://github.com/rust-lang/crates.io-index" 410 | checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" 411 | 412 | [[package]] 413 | name = "os_str_bytes" 414 | version = "6.4.1" 415 | source = "registry+https://github.com/rust-lang/crates.io-index" 416 | checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" 417 | 418 | [[package]] 419 | name = "ppv-lite86" 420 | version = "0.2.17" 421 | source = "registry+https://github.com/rust-lang/crates.io-index" 422 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" 423 | 424 | [[package]] 425 | name = "proc-macro-error" 426 | version = "1.0.4" 427 | source = "registry+https://github.com/rust-lang/crates.io-index" 428 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 429 | dependencies = [ 430 | "proc-macro-error-attr", 431 | "proc-macro2", 432 | "quote", 433 | "syn", 434 | "version_check", 435 | ] 436 | 437 | [[package]] 438 | name = "proc-macro-error-attr" 439 | version = "1.0.4" 440 | source = "registry+https://github.com/rust-lang/crates.io-index" 441 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 442 | dependencies = [ 443 | "proc-macro2", 444 | "quote", 445 | "version_check", 446 | ] 447 | 448 | [[package]] 449 | name = "proc-macro2" 450 | version = "1.0.51" 451 | source = "registry+https://github.com/rust-lang/crates.io-index" 452 | checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" 453 | dependencies = [ 454 | "unicode-ident", 455 | ] 456 | 457 | [[package]] 458 | name = "quote" 459 | version = "1.0.23" 460 | source = "registry+https://github.com/rust-lang/crates.io-index" 461 | checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" 462 | dependencies = [ 463 | "proc-macro2", 464 | ] 465 | 466 | [[package]] 467 | name = "rand" 468 | version = "0.8.5" 469 | source = "registry+https://github.com/rust-lang/crates.io-index" 470 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 471 | dependencies = [ 472 | "libc", 473 | "rand_chacha", 474 | "rand_core", 475 | ] 476 | 477 | [[package]] 478 | name = "rand_chacha" 479 | version = "0.3.1" 480 | source = "registry+https://github.com/rust-lang/crates.io-index" 481 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 482 | dependencies = [ 483 | "ppv-lite86", 484 | "rand_core", 485 | ] 486 | 487 | [[package]] 488 | name = "rand_core" 489 | version = "0.6.4" 490 | source = "registry+https://github.com/rust-lang/crates.io-index" 491 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 492 | dependencies = [ 493 | "getrandom", 494 | ] 495 | 496 | [[package]] 497 | name = "redox_syscall" 498 | version = "0.2.16" 499 | source = "registry+https://github.com/rust-lang/crates.io-index" 500 | checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" 501 | dependencies = [ 502 | "bitflags", 503 | ] 504 | 505 | [[package]] 506 | name = "redox_users" 507 | version = "0.4.3" 508 | source = "registry+https://github.com/rust-lang/crates.io-index" 509 | checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" 510 | dependencies = [ 511 | "getrandom", 512 | "redox_syscall", 513 | "thiserror", 514 | ] 515 | 516 | [[package]] 517 | name = "run_script" 518 | version = "0.10.0" 519 | source = "registry+https://github.com/rust-lang/crates.io-index" 520 | checksum = "7fdc55b3a7ad58e02de47eaf7a854c6791c8421da48ff296c152317d3beaf230" 521 | dependencies = [ 522 | "fsio", 523 | ] 524 | 525 | [[package]] 526 | name = "rustix" 527 | version = "0.36.8" 528 | source = "registry+https://github.com/rust-lang/crates.io-index" 529 | checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" 530 | dependencies = [ 531 | "bitflags", 532 | "errno", 533 | "io-lifetimes", 534 | "libc", 535 | "linux-raw-sys", 536 | "windows-sys", 537 | ] 538 | 539 | [[package]] 540 | name = "same-file" 541 | version = "1.0.6" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 544 | dependencies = [ 545 | "winapi-util", 546 | ] 547 | 548 | [[package]] 549 | name = "scratch" 550 | version = "1.0.3" 551 | source = "registry+https://github.com/rust-lang/crates.io-index" 552 | checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" 553 | 554 | [[package]] 555 | name = "serde" 556 | version = "1.0.152" 557 | source = "registry+https://github.com/rust-lang/crates.io-index" 558 | checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" 559 | dependencies = [ 560 | "serde_derive", 561 | ] 562 | 563 | [[package]] 564 | name = "serde_derive" 565 | version = "1.0.152" 566 | source = "registry+https://github.com/rust-lang/crates.io-index" 567 | checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" 568 | dependencies = [ 569 | "proc-macro2", 570 | "quote", 571 | "syn", 572 | ] 573 | 574 | [[package]] 575 | name = "serde_spanned" 576 | version = "0.6.1" 577 | source = "registry+https://github.com/rust-lang/crates.io-index" 578 | checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" 579 | dependencies = [ 580 | "serde", 581 | ] 582 | 583 | [[package]] 584 | name = "strsim" 585 | version = "0.10.0" 586 | source = "registry+https://github.com/rust-lang/crates.io-index" 587 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 588 | 589 | [[package]] 590 | name = "sun-times" 591 | version = "0.1.2" 592 | source = "registry+https://github.com/rust-lang/crates.io-index" 593 | checksum = "0abaea24076432ee036aa9faa615e6c565657693ea076fa7bb31249f6643eeb1" 594 | dependencies = [ 595 | "chrono", 596 | ] 597 | 598 | [[package]] 599 | name = "syn" 600 | version = "1.0.107" 601 | source = "registry+https://github.com/rust-lang/crates.io-index" 602 | checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" 603 | dependencies = [ 604 | "proc-macro2", 605 | "quote", 606 | "unicode-ident", 607 | ] 608 | 609 | [[package]] 610 | name = "termcolor" 611 | version = "1.2.0" 612 | source = "registry+https://github.com/rust-lang/crates.io-index" 613 | checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" 614 | dependencies = [ 615 | "winapi-util", 616 | ] 617 | 618 | [[package]] 619 | name = "thiserror" 620 | version = "1.0.38" 621 | source = "registry+https://github.com/rust-lang/crates.io-index" 622 | checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" 623 | dependencies = [ 624 | "thiserror-impl", 625 | ] 626 | 627 | [[package]] 628 | name = "thiserror-impl" 629 | version = "1.0.38" 630 | source = "registry+https://github.com/rust-lang/crates.io-index" 631 | checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" 632 | dependencies = [ 633 | "proc-macro2", 634 | "quote", 635 | "syn", 636 | ] 637 | 638 | [[package]] 639 | name = "time" 640 | version = "0.1.45" 641 | source = "registry+https://github.com/rust-lang/crates.io-index" 642 | checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" 643 | dependencies = [ 644 | "libc", 645 | "wasi 0.10.0+wasi-snapshot-preview1", 646 | "winapi", 647 | ] 648 | 649 | [[package]] 650 | name = "toml" 651 | version = "0.7.2" 652 | source = "registry+https://github.com/rust-lang/crates.io-index" 653 | checksum = "f7afcae9e3f0fe2c370fd4657108972cbb2fa9db1b9f84849cefd80741b01cb6" 654 | dependencies = [ 655 | "serde", 656 | "serde_spanned", 657 | "toml_datetime", 658 | "toml_edit", 659 | ] 660 | 661 | [[package]] 662 | name = "toml_datetime" 663 | version = "0.6.1" 664 | source = "registry+https://github.com/rust-lang/crates.io-index" 665 | checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" 666 | dependencies = [ 667 | "serde", 668 | ] 669 | 670 | [[package]] 671 | name = "toml_edit" 672 | version = "0.19.3" 673 | source = "registry+https://github.com/rust-lang/crates.io-index" 674 | checksum = "5e6a7712b49e1775fb9a7b998de6635b299237f48b404dde71704f2e0e7f37e5" 675 | dependencies = [ 676 | "indexmap", 677 | "nom8", 678 | "serde", 679 | "serde_spanned", 680 | "toml_datetime", 681 | ] 682 | 683 | [[package]] 684 | name = "unicase" 685 | version = "2.6.0" 686 | source = "registry+https://github.com/rust-lang/crates.io-index" 687 | checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" 688 | dependencies = [ 689 | "version_check", 690 | ] 691 | 692 | [[package]] 693 | name = "unicode-ident" 694 | version = "1.0.6" 695 | source = "registry+https://github.com/rust-lang/crates.io-index" 696 | checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" 697 | 698 | [[package]] 699 | name = "unicode-width" 700 | version = "0.1.10" 701 | source = "registry+https://github.com/rust-lang/crates.io-index" 702 | checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" 703 | 704 | [[package]] 705 | name = "version_check" 706 | version = "0.9.4" 707 | source = "registry+https://github.com/rust-lang/crates.io-index" 708 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 709 | 710 | [[package]] 711 | name = "walkdir" 712 | version = "2.3.2" 713 | source = "registry+https://github.com/rust-lang/crates.io-index" 714 | checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" 715 | dependencies = [ 716 | "same-file", 717 | "winapi", 718 | "winapi-util", 719 | ] 720 | 721 | [[package]] 722 | name = "wasi" 723 | version = "0.10.0+wasi-snapshot-preview1" 724 | source = "registry+https://github.com/rust-lang/crates.io-index" 725 | checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" 726 | 727 | [[package]] 728 | name = "wasi" 729 | version = "0.11.0+wasi-snapshot-preview1" 730 | source = "registry+https://github.com/rust-lang/crates.io-index" 731 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 732 | 733 | [[package]] 734 | name = "wasm-bindgen" 735 | version = "0.2.84" 736 | source = "registry+https://github.com/rust-lang/crates.io-index" 737 | checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" 738 | dependencies = [ 739 | "cfg-if", 740 | "wasm-bindgen-macro", 741 | ] 742 | 743 | [[package]] 744 | name = "wasm-bindgen-backend" 745 | version = "0.2.84" 746 | source = "registry+https://github.com/rust-lang/crates.io-index" 747 | checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" 748 | dependencies = [ 749 | "bumpalo", 750 | "log", 751 | "once_cell", 752 | "proc-macro2", 753 | "quote", 754 | "syn", 755 | "wasm-bindgen-shared", 756 | ] 757 | 758 | [[package]] 759 | name = "wasm-bindgen-macro" 760 | version = "0.2.84" 761 | source = "registry+https://github.com/rust-lang/crates.io-index" 762 | checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" 763 | dependencies = [ 764 | "quote", 765 | "wasm-bindgen-macro-support", 766 | ] 767 | 768 | [[package]] 769 | name = "wasm-bindgen-macro-support" 770 | version = "0.2.84" 771 | source = "registry+https://github.com/rust-lang/crates.io-index" 772 | checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" 773 | dependencies = [ 774 | "proc-macro2", 775 | "quote", 776 | "syn", 777 | "wasm-bindgen-backend", 778 | "wasm-bindgen-shared", 779 | ] 780 | 781 | [[package]] 782 | name = "wasm-bindgen-shared" 783 | version = "0.2.84" 784 | source = "registry+https://github.com/rust-lang/crates.io-index" 785 | checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" 786 | 787 | [[package]] 788 | name = "winapi" 789 | version = "0.3.9" 790 | source = "registry+https://github.com/rust-lang/crates.io-index" 791 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 792 | dependencies = [ 793 | "winapi-i686-pc-windows-gnu", 794 | "winapi-x86_64-pc-windows-gnu", 795 | ] 796 | 797 | [[package]] 798 | name = "winapi-i686-pc-windows-gnu" 799 | version = "0.4.0" 800 | source = "registry+https://github.com/rust-lang/crates.io-index" 801 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 802 | 803 | [[package]] 804 | name = "winapi-util" 805 | version = "0.1.5" 806 | source = "registry+https://github.com/rust-lang/crates.io-index" 807 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 808 | dependencies = [ 809 | "winapi", 810 | ] 811 | 812 | [[package]] 813 | name = "winapi-x86_64-pc-windows-gnu" 814 | version = "0.4.0" 815 | source = "registry+https://github.com/rust-lang/crates.io-index" 816 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 817 | 818 | [[package]] 819 | name = "windows-sys" 820 | version = "0.45.0" 821 | source = "registry+https://github.com/rust-lang/crates.io-index" 822 | checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" 823 | dependencies = [ 824 | "windows-targets", 825 | ] 826 | 827 | [[package]] 828 | name = "windows-targets" 829 | version = "0.42.1" 830 | source = "registry+https://github.com/rust-lang/crates.io-index" 831 | checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" 832 | dependencies = [ 833 | "windows_aarch64_gnullvm", 834 | "windows_aarch64_msvc", 835 | "windows_i686_gnu", 836 | "windows_i686_msvc", 837 | "windows_x86_64_gnu", 838 | "windows_x86_64_gnullvm", 839 | "windows_x86_64_msvc", 840 | ] 841 | 842 | [[package]] 843 | name = "windows_aarch64_gnullvm" 844 | version = "0.42.1" 845 | source = "registry+https://github.com/rust-lang/crates.io-index" 846 | checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" 847 | 848 | [[package]] 849 | name = "windows_aarch64_msvc" 850 | version = "0.42.1" 851 | source = "registry+https://github.com/rust-lang/crates.io-index" 852 | checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" 853 | 854 | [[package]] 855 | name = "windows_i686_gnu" 856 | version = "0.42.1" 857 | source = "registry+https://github.com/rust-lang/crates.io-index" 858 | checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" 859 | 860 | [[package]] 861 | name = "windows_i686_msvc" 862 | version = "0.42.1" 863 | source = "registry+https://github.com/rust-lang/crates.io-index" 864 | checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" 865 | 866 | [[package]] 867 | name = "windows_x86_64_gnu" 868 | version = "0.42.1" 869 | source = "registry+https://github.com/rust-lang/crates.io-index" 870 | checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" 871 | 872 | [[package]] 873 | name = "windows_x86_64_gnullvm" 874 | version = "0.42.1" 875 | source = "registry+https://github.com/rust-lang/crates.io-index" 876 | checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" 877 | 878 | [[package]] 879 | name = "windows_x86_64_msvc" 880 | version = "0.42.1" 881 | source = "registry+https://github.com/rust-lang/crates.io-index" 882 | checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" 883 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dyn-wall-rs" 3 | version = "2.1.3" 4 | authors = ["RAR27 "] 5 | edition = "2018" 6 | license = "GPL-3.0-or-later" 7 | description = "Helps user set a dynamic wallpaper and lockscreen. For more info and help, go to https://github.com/RAR27/dyn-wall-rs" 8 | repository = "https://github.com/RAR27/dyn-wall-rs" 9 | readme = "README.md" 10 | keywords = ["dynamic", "wallpaper"] 11 | categories = ["command-line-utilities"] 12 | exclude = [ 13 | "demo.gif" 14 | ] 15 | 16 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 17 | 18 | [dependencies] 19 | chrono = "0.4.23" 20 | clokwerk = "0.4.0" 21 | walkdir = "2.3.2" 22 | alphanumeric-sort = "1.4.4" 23 | run_script = "0.10.0" 24 | unicase = "2.6.0" 25 | winapi = { version = "0.3.9", features = ["winuser"] } 26 | clap = { version = "4.1.4", features = ["derive"] } 27 | serde = { version = "1.0.152", features = ["derive"] } 28 | toml = "0.7.2" 29 | sun-times = "0.1.2" 30 | dirs-next = "2.0.0" 31 | rand = "0.8.5" 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dyn-wall-rs 2 | 3 | ![GitHub](https://img.shields.io/github/license/RAR27/dyn-wall-rs) 4 | [![GitHub release (latest by date)](https://img.shields.io/github/v/release/RAR27/dyn-wall-rs)](https://github.com/RAR27/dyn-wall-rs) 5 | [![Crates.io](https://img.shields.io/crates/v/dyn-wall-rs)](https://crates.io/crates/dyn-wall-rs) 6 | [![AUR](https://img.shields.io/aur/version/dyn-wall-rs)](https://aur.archlinux.org/packages/dyn-wall-rs/) 7 | 8 | A utility to allow you to set a dynamic wallpaper and more.\ 9 | Written in rust. 10 | 11 | ![demo][DEMO] 12 | 13 | The images used in the gif above are from the collection [Lakeside by Louis Coyle](https://dynamicwallpaper.club/wallpaper/jculsb683ok). 14 | 15 | ## Introduction 16 | The aim of dyn-wall-rs is to provide users with a very simple and easy way to implement a dynamic wallpaper, as well as the setup of related things, such as the implementation of a dynamic lockscreen. 17 | 18 | 19 | ## Installation 20 | You can download the binary from the [releases][RELEASES] page but if you prefer, you can install through one of the methods listed below.\ 21 | **NOTE: [Feh](https://feh.finalrewind.org/) needs to be installed if you are using a Window Manager** 22 | 23 | ### AUR 24 | For those using Arch Linux you can find the package on the AUR [here](https://aur.archlinux.org/packages/dyn-wall-rs/). However, if you're using an AUR helper, the package can be installed through that. For example, If using [yay](https://github.com/Jguer/yay), run the following command: 25 | ``` 26 | yay -S dyn-wall-rs 27 | ``` 28 | **Looking for maintainer for the AUR package. Email me at rar27@tuta.io if you are interested.** 29 | 30 | ### Cargo 31 | First, install rust, and then run the following command: 32 | ``` 33 | cargo install dyn-wall-rs 34 | ``` 35 | To update after installation, run: 36 | ``` 37 | cargo install dyn-wall-rs --force 38 | ``` 39 | 40 | ### Manual 41 | #### Unix 42 | 1. Download the latest binary from the [releases](RELEASES) page 43 | 2. (**Optional**) To ensure the file you downloaded is correct and was not tampered with, do the following: 44 | 1. Download the respective `.sha256` file 45 | 2. Run `sha256sum` on the `.tar.gz` file 46 | 3. Compare the output of the command with the contents of the `.sha256` file. If they are the same, then your file has not been tampered with 47 | 3. Unpack the `.tar.gz file` by running\ 48 | `tar -zxvf dyn-wall-rs.tar.gz` 49 | 4. You can now run it by running `./dyn-wall-rs` in the directory the binary was unpacked. It is recommended to place the binary in your $PATH (ex. `/usr/bin`, which is commonly used), so you can use it from anywhere 50 | 51 | #### Windows 52 | 1. Download the latest binary from the [releases](RELEASES) page 53 | 2. (**Optional**) To ensure the file you downloaded is correct and was not tampered with, do the following: 54 | 1. Download the respective `.sha256` file 55 | 2. Open PowerShell, move to the directory contining the zip, and run\ 56 | `Get-FileHash dyn-wall-rs-windows.zip -Algorithm SHA256 | Format-List` 57 | 3. Compare the sha256 the command provides with the contents of the `.sha256` file. If they are the same, then your file has not been tampered with 58 | 3. Unzip the `.zip` file 59 | 4. You can now run it by opening up PowerShell and running `./dyn-wall-rs` in the directory the binary was unpacked. It is recommended to place the binary in your $PATH, so you can use it from anywhere 60 | 61 | ## Usage 62 | Firstly, create a directory and place all the wallpapers you want to cycle through within the directory. Make sure that they are named in numerical order ex. first wallpaper is named 1.png, second wallpaper is named 2.png, etc. 63 | 64 | ### Command Line 65 | There are a few different ways to use dyn-wall-rs from the command line using the different flags, which are described in detail below 66 | * **-d, --directory \**\ 67 | Changes your wallpaper throughout the day with the images in the directory. If custom timings are not specified through the config file, it changes in even increments throughout the day.\ 68 | For example, if I have 12 wallpapers in my wallpaper directory, this option would change the wallpaper every 2 hours (24/12 = 2). Make sure the number of wallpapers in the directory can divide evenly into 1440 (number of minutes in a day). If it doesn't divide evenly into 1440, you may want to place custom timings in the configuration file.\ 69 | If timings are specified through the configuration file, then the wallpapers will change based on those timings. More information on custom timings can be found within the automatically created config file. 70 | 71 | * **-p, --programs \**\ 72 | Will send the wallpaper as an argument to the specified program(s) when the wallpaper is set to change. Using this feature, you can have your lockscreen change alongside your wallpaper. If the command includes arguments, wrap it in quotation marks.\ 73 | ex. `dyn-wall-rs -d /path/to/dir/ -p "betterlockscreen -u"` 74 | 75 | To be able to send arguments *after* the wallpaper argument, use `!WALL` to specify where the wallpaper argument is to be placed, and add the rest of the arguments. `!WALL` will be explanded to the path of the wallpaper to be set at the current time.\ 76 | ex. `dyn-wall-rs -d /path/to/dir -p "betterlockscreen -u !WALL -b 1"` 77 | 78 | You are also able to specifiy multiple programs to be synced with the wallpaper. Simply just insert the program names one after the other 79 | ex. `dyn-wall-rs -d /path/to/dir -p "betterlockscreen -u" "echo"` 80 | 81 | * **-s, --schedule**\ 82 | Prints out a schedule of the times at which the wallpaper will change depending on your settings. Use alongside the `--directory` option.\ 83 | **Note: Cannot be set through config file.** 84 | 85 | * **-b, --backend \**\ 86 | Uses the specified method as the backend to change the wallpaper. Type a supported DE name to use that DE's wallpaper changing command (Case insensitive), or type out a custom command to use as a backend. Similar to the `program` option, you can use `!WALL` in place of where the path of the wallpaper should be. 87 | 88 | * **--lat \**\ 89 | Latitude of current location. Requires the use of the `long` option as well. 90 | 91 | * **--long \**\ 92 | Longitude of current location. Requires the use of the `lat` option as well. 93 | 94 | * **--elevation \**\ 95 | Elevation of current location. Optional. Use alongside `long` and `lat` options for a more accurate sunset and sunrise reading. Expressed in meters above sea level. 96 | 97 | Once you figure out which options you want to use and test it to make sure its working how you want it to, have the command autostart on boot. 98 | 99 | ### Config File 100 | dyn-wall-rs can also be configured through a config file. When you run the program for the first time, a config file will be created at `~/.config/dyn-wall-rs/config.toml` for Unix systems, and `C:\Users\\AppData\Roaming\dyn-wall-rs.toml` on Windows. 101 | 102 | Through this config file, you can use the same configuration options as through the command line (except the `schedule` option), as well as use your own custom timings. If you would like to configure certain parameters from the config file, and others from the command line, you are able to do so. More details can be found in the automatically created config file. 103 | 104 | ### Systemd Service 105 | On systemd systems, a systemd service such as [this](https://github.com/RAR27/dyn-wall-rs/blob/master/dyn-wall-rs.service) one can be used. If installing from the AUR, this service file should already be in the right location. If you haven't installed from the AUR, you can download and move the service file to `/usr/lib/systemd/system/dyn-wall-rs.service`. The service can be enabled with the command `systemctl --user enable dyn-wall-rs.service`. If you are running the program with command line arguments, then the service file can be edited to include those arguments. 106 | 107 | ### Syncing to the sun 108 | In order to sync the changing of wallpapers according to the sunset and sunrise timings, create directories within the master directory named `night` and `day`. This will cycle through the wallpapers in the `day` directory if the current time is before the sunset time, and will cycle through the wallpapers in the `night` directory. After the directories are created and the wallpapers are placed in them, specify your latitude, longitude, and elevation (optional), and let the program do its work! You can find your coordinates through [this](https://www.mapcoordinates.net/en) website. 109 | 110 | ### Sway 111 | To use with sway, download the `swaybg-dyn.sh` script, and supply a path to it using the `backend` option. 112 | ```bash 113 | dyn-wall-rs -d ~/Pictures/backgrounds/ -b ~/Scripts/swaybg-dyn.sh 114 | ``` 115 | 116 | ## Supported Desktop Environments 117 | * Windows 118 | * Gnome 119 | * Ubuntu 120 | * Pantheon 121 | * Deepin 122 | * Pop 123 | * KDE 124 | * LXDE 125 | * XFCE 126 | * Window Managers that can have their wallpaper set using Feh 127 | * Sway 128 | 129 | [RELEASES]: https://github.com/RAR27/dyn-wall-rs/releases 130 | [DEMO]: https://raw.githubusercontent.com/RAR27/dyn-wall-rs/master/demo.gif 131 | -------------------------------------------------------------------------------- /config file examples/config.toml: -------------------------------------------------------------------------------- 1 | times = [ 2 | "00:00" 3 | "02:00" 4 | "04:00" 5 | "08:30" 6 | "12:44" 7 | "20:00" 8 | ] 9 | directory = "/home/popeye/pics\ of\ spinach" 10 | programs = ["betterlockscreen -u", "wal -i"] 11 | backend = "feh" 12 | -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rehanzo/dyn-wall-rs/54b5d20c06027bdf921cc6e9ea25e2802333f7c4/demo.gif -------------------------------------------------------------------------------- /dyn-wall-rs.service: -------------------------------------------------------------------------------- 1 | # Requirements: 2 | # - dyn-wall-rs in /usr/local/bin 3 | # - a $HOME/.config/dyn-wall-rs.toml file 4 | # 5 | # Copy to $HOME/.config/systemd/user/dyn-wall-rs.service 6 | # (create $HOME/.config/systemd/user first if not yet existing) 7 | # 8 | # Then run 9 | # systemctl --user daemon-reload 10 | # systemctl --user enable dyn-wall-rs.service 11 | # systemctl --user start dyn-wall-rs.service 12 | # 13 | # Optionally run the below to enable the service to run 14 | # when logged out (i.e. to show dynamic wallpapers in the display manager) 15 | # loginctl enable-linger 16 | # 17 | [Unit] 18 | Description=dyn-wall-rs service 19 | 20 | [Service] 21 | Type=simple 22 | ExecStart=/usr/bin/dyn-wall-rs 23 | ExecStartPost=/usr/bin/dyn-wall-rs --schedule 24 | 25 | PrivateTmp=1 26 | 27 | [Install] 28 | WantedBy=default.target 29 | -------------------------------------------------------------------------------- /scripts/swaybg-dyn.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PID=`pidof swaybg` 3 | swaybg -o "*" -i "$1" -m fill & 4 | sleep 1 5 | kill $PID 6 | -------------------------------------------------------------------------------- /src/config.rs: -------------------------------------------------------------------------------- 1 | /* 2 | dyn-wall-rs 2.1.3 3 | Rehan Rana 4 | Helps user set a dynamic wallpaper and lockscreen. For more info and help, go to https://github.com/RAR27/dyn-wall-rs 5 | Copyright (C) 2021 Rehan Rana 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | use crate::{check_dir_exists, sun_timings, ConfigFileErrors, Errors, Time}; 22 | use clap::Parser; 23 | use dirs_next::config_dir; 24 | use serde::{Deserialize, Serialize}; 25 | use std::{ 26 | error::Error, 27 | fs::create_dir_all, 28 | fs::File, 29 | io::{Read, Write}, 30 | str::FromStr, 31 | }; 32 | 33 | #[derive(Parser, Default)] 34 | #[command(author, version, about = "Helps user set a dynamic wallpaper and lockscreen. Make sure the wallpapers are named in numerical order based on the order you want. For more info and help, go to https://github.com/RAR27/dyn-wall-rs", long_about = None)] 35 | #[derive(Serialize, Deserialize, Debug, PartialEq)] 36 | pub struct Args { 37 | #[arg( 38 | short, 39 | long, 40 | value_name = "DIRECTORY", 41 | help = "Sets the wallpaper based on the current time and changes the wallpaper throughout the day. The wallpaper will change based on the user specified times within the config file, if custom timings are not set, or if location isn't specified, it will automatically divide the wallpapers into equal parts throughout the day.", 42 | conflicts_with = "schedule" 43 | )] 44 | pub directory: Option, 45 | 46 | #[arg( 47 | short = 'p', 48 | long = "programs", 49 | value_name = "COMMAND", 50 | help = r#"Sends image as argument to command specified. Use alongside the directory option. If the command itself contains arguments, wrap in quotation ex. dyn-wall-rs -a /path/to/dir -l "betterlockscreen -u""# 51 | )] 52 | pub programs: Option>, 53 | 54 | #[arg( 55 | short, 56 | long, 57 | help = "Prints change schedule. Use alongside directory option", 58 | //requires = "directory", 59 | num_args = 0, 60 | )] 61 | #[serde(skip)] 62 | pub schedule: bool, 63 | 64 | #[arg( 65 | short, 66 | long, 67 | value_name = "BACKEND", 68 | help = "Uses the specified method as the backend to change the wallpaper. Custom command can be used" 69 | )] 70 | pub backend: Option, 71 | 72 | #[arg( 73 | long, 74 | value_name = "LATITUDE", 75 | help = "Latitude of current location. Requires the use of the long option", 76 | //requires_all = &["long", "elevation"], 77 | allow_hyphen_values(true) 78 | )] 79 | pub lat: Option, 80 | 81 | #[arg( 82 | long, 83 | value_name = "LONGITUDE", 84 | help = "Longitude of current location. Requires the use of the lat option", 85 | //requires_all = &["lat", "elevation"], 86 | allow_hyphen_values(true) 87 | )] 88 | pub long: Option, 89 | 90 | #[arg( 91 | long, 92 | value_name = "ELEVATION", 93 | help = "Elevation of current location. Optional. expressed in meters above sea level.", 94 | //requires_all = &["lat", "long"], 95 | allow_hyphen_values(true) 96 | )] 97 | pub elevation: Option, 98 | 99 | #[arg( 100 | short = 'i', 101 | long, 102 | value_name = "DAYS", 103 | help = "Days between wallpaper changes" 104 | )] 105 | pub days: Option, 106 | 107 | #[arg( 108 | short = 'c', 109 | long = "current", 110 | help = "Returns currently set wallpaper filepath", 111 | num_args = 0 112 | )] 113 | #[serde(skip)] 114 | pub ret_curr_wp: bool, 115 | 116 | #[arg(skip)] 117 | #[serde(skip)] 118 | pub times: Option>, 119 | } 120 | 121 | //not optimal, but it seems serde can really only work on structs. Would be great if I could 122 | //serialize straight into a vector, but it doesn't seem like I can, so this is a workaround 123 | #[derive(Deserialize, Serialize)] 124 | pub struct Times { 125 | pub times: Option>, 126 | } 127 | 128 | impl Args { 129 | pub fn mixed(cli_args: Args, cli_args_used: bool) -> Result> { 130 | //rust doesn't let you assign when deconstructing, so this workaround is required 131 | let (temp_times, config_args) = config_parse(cli_args_used)?; 132 | 133 | let mut args = Args { 134 | directory: if cli_args.directory.is_some() { 135 | cli_args.directory 136 | } else { 137 | config_args.directory 138 | }, 139 | programs: if cli_args.programs.is_some() { 140 | cli_args.programs 141 | } else { 142 | config_args.programs 143 | }, 144 | schedule: cli_args.schedule, 145 | backend: if cli_args.backend.is_some() { 146 | cli_args.backend 147 | } else { 148 | config_args.backend 149 | }, 150 | lat: if cli_args.lat.is_some() { 151 | cli_args.lat 152 | } else { 153 | config_args.lat 154 | }, 155 | long: if cli_args.long.is_some() { 156 | cli_args.long 157 | } else { 158 | config_args.long 159 | }, 160 | elevation: if cli_args.elevation.is_some() { 161 | cli_args.elevation 162 | } else { 163 | config_args.elevation 164 | }, 165 | days: if cli_args.days.is_some() { 166 | cli_args.days 167 | } else { 168 | config_args.days 169 | }, 170 | ret_curr_wp: cli_args.ret_curr_wp, 171 | times: temp_times, 172 | }; 173 | //the default is all fields none, this is fine becuase if other options are used by 174 | //themselves, specific errors come up. 175 | if Args::default() == args { 176 | Err("Directory not specified".into()) 177 | } 178 | //if latitude is specified, then longitude and elevation is required as well, so we 179 | //just need to check for one of them 180 | else if let Some(lat) = args.lat { 181 | if args.long.is_none() { 182 | Err("Error: lat needs to be specified with long".into()) 183 | } else { 184 | let dir = args.directory.to_owned(); 185 | match dir { 186 | None => Err("Error: Directory needs to be specified".into()), 187 | Some(dir) => { 188 | let dir = dir.as_str(); 189 | match sun_timings( 190 | dir, 191 | lat, 192 | args.long.unwrap(), 193 | args.elevation.or_else(|| Some(0.0)).unwrap(), 194 | ) { 195 | Err(e) => Err(format!("Error: {}", e).into()), 196 | Ok(s) => { 197 | args.times = Some(s); 198 | Ok(args) 199 | } 200 | } 201 | } 202 | } 203 | } 204 | } else if args.long.is_some() { 205 | Err("Error: long neds to be specified with lat".into()) 206 | } 207 | //handle custom programs specified by user 208 | else if args.programs.is_some() && args.directory.is_none() && !args.schedule { 209 | Err("Error: The program option is to be used with a specified directory".into()) 210 | } 211 | //handle custom backend specified by user 212 | else if args.backend.is_some() && args.directory.is_none() { 213 | Err("Error: The backend option is to be used with a specified directory".into()) 214 | } else if args.schedule && args.directory.is_none() { 215 | Err("Error: The schedule option is to be used alongside a specified directory".into()) 216 | } else { 217 | if !args.ret_curr_wp { 218 | check_dir_exists(&args.directory.to_owned().unwrap())?; 219 | } 220 | Ok(args) 221 | } 222 | } 223 | } 224 | 225 | //parse config file 226 | type UserInput = (Option>, Args); 227 | pub fn config_parse(cli_args_used: bool) -> Result> { 228 | let file = File::open(format!( 229 | "{}/dyn-wall-rs/config.toml", 230 | config_dir() 231 | .ok_or_else(|| Errors::ConfigFileError(ConfigFileErrors::NotFound))? 232 | .to_str() 233 | .unwrap() 234 | )) 235 | .map_err(|_| Errors::ConfigFileError(ConfigFileErrors::NotFound)); 236 | 237 | let file = match file { 238 | Ok(s) => Ok(s), 239 | Err(e) => { 240 | create_config()?; 241 | Err(e) 242 | } 243 | }; 244 | 245 | if file.is_err() { 246 | return Err("A config file has been created".into()); 247 | } 248 | let mut file = file.unwrap(); 249 | 250 | let mut contents = String::new(); 251 | file.read_to_string(&mut contents)?; 252 | 253 | if !cli_args_used { 254 | let mut empty = true; 255 | for line in contents.lines() { 256 | if !line.contains('#') { 257 | empty = false; 258 | } 259 | } 260 | if empty { 261 | //provide our own error if empty, rather than less descriptive error from serde 262 | return Err(Errors::ConfigFileError(ConfigFileErrors::Empty).into()); 263 | } 264 | } 265 | 266 | let args_string = toml::from_str(contents.as_str()); 267 | let args_serialized: Args = match args_string { 268 | Err(e) => { 269 | return Err(Errors::ConfigFileError(ConfigFileErrors::Other(e.to_string())).into()); 270 | } 271 | Ok(s) => s, 272 | }; 273 | 274 | let times_string = toml::from_str(contents.as_str()); 275 | let times_serialized: Times = match times_string { 276 | Err(e) => { 277 | return Err(Errors::ConfigFileError(ConfigFileErrors::Other(e.to_string())).into()); 278 | } 279 | Ok(s) => s, 280 | }; 281 | 282 | match times_serialized.times { 283 | None => Ok((None, args_serialized)), 284 | Some(s) => { 285 | let times: Result, _> = s.iter().map(|time| Time::from_str(time)).collect(); 286 | let times = times?; 287 | Ok((Some(times), args_serialized)) 288 | } 289 | } 290 | } 291 | 292 | fn create_config() -> Result<(), Box> { 293 | let config_dir = 294 | config_dir().ok_or_else(|| Errors::ConfigFileError(ConfigFileErrors::NotFound))?; 295 | create_dir_all(format!("{}/dyn-wall-rs", config_dir.to_str().unwrap()))?; 296 | let mut config_file = File::create(format!( 297 | "{}/dyn-wall-rs/config.toml", 298 | config_dir.to_str().unwrap() 299 | ))?; 300 | let contents = r#"# Type the times at which you want the wallpaper to change as shown in the example below 301 | # The times must be in chronological order 302 | # The number of images and the number of times should be equal 303 | # 304 | # ex: 305 | # times = [ 306 | # "00:00", 307 | # "02:00", 308 | # "04:00", 309 | # "06:00", 310 | # "08:00", 311 | # "10:00", 312 | # "12:00", 313 | # "14:00", 314 | # "16:00", 315 | # "18:00", 316 | # "20:00", 317 | # "22:00", 318 | # ] 319 | # 320 | # The times are linked to the files in numerical order. This means that in the example above, 321 | # 1.png will be your wallpaper at 00:00, 2.png will be your wallpaper at 02:00, etc. 322 | # The directory would need 12 images for this example to work, since there are 12 times stated 323 | # Config options are stated below; uncomment them and fill them as you would from the command line. 324 | #times = [] 325 | #directory = "/path/to/dir" 326 | #backend = "feh" 327 | #program = ["echo test1", "echo test2"] 328 | #lat = 99 329 | #long = -99 330 | #elevation = 99"#; 331 | 332 | config_file.write_all(contents.as_bytes())?; 333 | Ok(()) 334 | } 335 | -------------------------------------------------------------------------------- /src/errors.rs: -------------------------------------------------------------------------------- 1 | /* 2 | dyn-wall-rs 2.1.3 3 | Rehan Rana 4 | Helps user set a dynamic wallpaper and lockscreen. For more info and help, go to https://github.com/RAR27/dyn-wall-rs 5 | Copyright (C) 2020 Rehan Rana 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | use dirs_next::config_dir; 21 | use std::{error, fmt}; 22 | 23 | #[cfg(not(windows))] 24 | const DIR_SLASH: &str = "/"; 25 | #[cfg(windows)] 26 | const DIR_SLASH: &str = r#"\"#; 27 | 28 | #[derive(Debug)] 29 | ///Custom error types 30 | pub enum Errors { 31 | FilePathError, 32 | ProgramRunError(String), 33 | CountCompatError(usize), 34 | DirNonExistantError(String), 35 | NoFilesFoundError(String), 36 | ConfigFileError(ConfigFileErrors), 37 | BackendNotFoundError(String), 38 | } 39 | 40 | #[derive(Debug)] 41 | ///Custom error subtypes for ConfigFileError 42 | pub enum ConfigFileErrors { 43 | Empty, 44 | FileTimeMismatch, 45 | FormattingError, 46 | NotFound, 47 | OutOfOrder, 48 | OutOfRange, 49 | DuplicatesFound, 50 | Other(String), 51 | } 52 | 53 | impl error::Error for Errors {} 54 | 55 | impl fmt::Display for Errors { 56 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 57 | match self { 58 | Errors::FilePathError => write!(f, "Error while handling file path"), 59 | Errors::ProgramRunError(prog) => write!(f, "Error while running {}", prog), 60 | Errors::CountCompatError(count) => { 61 | match count { 62 | 0 => { 63 | write!(f, "No images found in the given directory") 64 | } 65 | _ => { 66 | write!(f, "Cannot schedule the rotation of {} images evenly throughout the day (the number of images should divide evenly into 1440)", count) 67 | } 68 | } 69 | } 70 | Errors::DirNonExistantError(dir) => write!(f, "The directory {} doesn't exist", dir), 71 | Errors::NoFilesFoundError(loc) => write!(f, "No file(s) found at {}", loc), 72 | Errors::ConfigFileError(cause) => { 73 | let template = "Error with config file"; 74 | match cause { 75 | ConfigFileErrors::Empty => write!(f, "{}: config file is empty", template), 76 | ConfigFileErrors::FileTimeMismatch => write!(f, "{}: the number of times listed in the config file does not equal the number of files in directory", template), 77 | ConfigFileErrors::FormattingError => write!(f, "{}: config file not formatted correctly", template), 78 | ConfigFileErrors::NotFound => write!(f, "{}: config file not found. One has been created at {}{}dyn-wall-rs{}config.toml for you to edit", template, config_dir().expect("No config directory found").to_str().unwrap(), DIR_SLASH, DIR_SLASH), 79 | ConfigFileErrors::OutOfOrder => write!(f, "{}: the order of the times are incorrect", template), 80 | ConfigFileErrors::OutOfRange => write!(f, "{}: Custom times should be between 0 - 23:59", template), 81 | ConfigFileErrors::DuplicatesFound => write!(f, "{}: duplicate times found", template), 82 | ConfigFileErrors::Other(other_err) => write!(f, "{}: {}", template, other_err), 83 | } 84 | } 85 | Errors::BackendNotFoundError(backend) => write!(f, "Backend '{}' not found", backend), 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | dyn-wall-rs 2.1.3 3 | Rehan Rana 4 | Helps user set a dynamic wallpaper and lockscreen. For more info and help, go to https://github.com/RAR27/dyn-wall-rs 5 | Copyright (C) 2020 Rehan Rana 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | use crate::{ 21 | config::Args, 22 | errors::{ConfigFileErrors, Errors}, 23 | time_track::Time, 24 | }; 25 | use chrono::{Local, Timelike, Utc}; 26 | use clokwerk::{Scheduler, TimeUnits}; 27 | use dirs_next::data_dir; 28 | use std::{env, error::Error, process, process::Command, sync::Arc, thread::sleep, time::Duration}; 29 | use std::{ 30 | fs, 31 | fs::create_dir_all, 32 | fs::File, 33 | fs::OpenOptions, 34 | io::{Read, Write}, 35 | }; 36 | use walkdir::{DirEntry, WalkDir}; 37 | 38 | use clokwerk::Job; 39 | use rand::seq::SliceRandom; 40 | use rand::thread_rng; 41 | use run_script::ScriptOptions; 42 | use unicase::UniCase; 43 | 44 | #[cfg(not(windows))] 45 | use std::env::consts::ARCH; 46 | 47 | //crates used to change windows wallpaper 48 | #[cfg(windows)] 49 | use std::ffi::OsStr; 50 | #[cfg(windows)] 51 | use std::{io, iter, os::raw::c_void, os::windows::ffi::OsStrExt}; 52 | #[cfg(windows)] 53 | use winapi::um::winuser::{ 54 | SystemParametersInfoW, SPIF_SENDCHANGE, SPIF_UPDATEINIFILE, SPI_SETDESKWALLPAPER, 55 | }; 56 | 57 | pub mod config; 58 | pub mod errors; 59 | pub mod time_track; 60 | 61 | const FULL_DAY: Time = Time { 62 | hours: 24, 63 | mins: 0, 64 | total_mins: 1440, 65 | }; 66 | const MIDNIGHT: Time = Time { 67 | hours: 0, 68 | mins: 0, 69 | total_mins: 0, 70 | }; 71 | 72 | pub fn wallpaper_current_time( 73 | dir: &str, 74 | progs: Arc>>, 75 | times: &[Time], 76 | backend: Arc>, 77 | min_depth: usize, 78 | ) -> Result<(), Box> { 79 | let dir_iter = sorted_dir_iter(dir, min_depth); 80 | let dir_count = sorted_dir_iter(dir, min_depth); 81 | 82 | let dir_count: usize = dir_count.count(); 83 | let mut commands_vec: Vec = vec![]; 84 | let mut times_iter = times.iter(); 85 | let curr_time = Time::new(Local::now().hour() * 60 + Local::now().minute()); 86 | let loop_time = times_iter.next(); 87 | let mut next_time = times_iter.next().unwrap_or(&FULL_DAY); 88 | let mut filepath_set: String = String::new(); 89 | let mut last_image = String::new(); 90 | let first_time = times[0]; 91 | 92 | let mut loop_time = error_checking(times, loop_time, dir_count, None)?; 93 | 94 | //this loop is to find where the current time lays, and adjust the wallpaper based on that 95 | for file in dir_iter { 96 | //needed for the case where midnight is passed over in the middle of the stated times 97 | if loop_time > *next_time { 98 | loop_time = MIDNIGHT; 99 | } 100 | 101 | let filepath_temp = file.map_err(|_| Errors::FilePathError)?; 102 | let filepath_temp = filepath_temp.path(); 103 | 104 | let last_image_temp = filepath_temp.to_str().unwrap(); 105 | last_image = last_image_temp.to_owned(); 106 | 107 | if curr_time >= loop_time && curr_time < *next_time { 108 | filepath_set.push_str(match filepath_temp.to_str() { 109 | Some(filepath) => Ok(filepath), 110 | None => Err(Errors::FilePathError), 111 | }?); 112 | 113 | //this is to send the file as an argument to the user specified program, if one was specified 114 | commands_vec_loader(&filepath_set, Arc::clone(&progs), &mut commands_vec); 115 | } 116 | loop_time = *next_time; 117 | next_time = times_iter.next().unwrap_or(&first_time); 118 | } 119 | 120 | //this is for the edge case where the current time is after the last time specified for the day, but before the first one specified for the day 121 | //in that case, the previous loop would push nothing to filepath_set, and so nothing would be sent to feh 122 | //what we want in this situation is for the file that is associated with the last time of the day to be sent as an argument to feh, 123 | //and to the user specified program 124 | if filepath_set.is_empty() { 125 | de_command_spawn(&last_image, backend)?; 126 | 127 | commands_vec_loader(&last_image, Arc::clone(&progs), &mut commands_vec); 128 | filepath_set = last_image; 129 | } else { 130 | de_command_spawn(&filepath_set, backend)?; 131 | } 132 | 133 | if let Some(progs) = progs.as_deref() { 134 | let mut prog_iter = progs.iter(); 135 | for curr_command in commands_vec.iter_mut() { 136 | curr_command 137 | .spawn() 138 | .map_err(|_| Errors::ProgramRunError(String::from(prog_iter.next().unwrap())))?; 139 | println!( 140 | "The image {} has been sent as an argument to the specified program", 141 | filepath_set 142 | ); 143 | } 144 | } 145 | Ok(()) 146 | } 147 | 148 | pub fn wallpaper_listener(dir: String, args: Args, min_depth: usize) -> Result<(), Box> { 149 | let mut scheduler = Scheduler::new(); 150 | let mut sched_addto; 151 | let progs = Arc::new(args.programs); 152 | let backend = Arc::new(args.backend); 153 | let times = args.times.unwrap(); 154 | let days = args.days; 155 | let days_val = days.unwrap_or(1); 156 | if env::var("DYN_TEST").is_ok() { 157 | println!("DAYS = {}", days_val); 158 | } 159 | 160 | if days.is_none() { 161 | sched_addto = scheduler.every(1.day()).at("0:00"); 162 | wallpaper_current_time( 163 | &dir, 164 | Arc::clone(&progs), 165 | ×, 166 | Arc::clone(&backend), 167 | min_depth, 168 | )?; 169 | 170 | for time in × { 171 | let time_fmt = format!("{:02}:{:02}", time.hours, time.mins); 172 | sched_addto = sched_addto.and_every(1.day()).at(time_fmt.as_str()); 173 | } 174 | 175 | let sched_closure = move || { 176 | let result = wallpaper_current_time( 177 | &dir, 178 | Arc::clone(&progs), 179 | ×, 180 | Arc::clone(&backend), 181 | min_depth, 182 | ); 183 | 184 | match result { 185 | Ok(s) => s, 186 | Err(e) => { 187 | eprintln!("{}", e); 188 | process::exit(1); 189 | } 190 | } 191 | }; 192 | sched_addto.run(sched_closure); 193 | } else { 194 | sched_addto = scheduler.every(days_val.day()).at("00:00"); 195 | let curr_fp = file_data_load("visited_days")?.into_iter().last().unwrap(); 196 | set_wallpaper(&curr_fp, Arc::clone(&progs), Arc::clone(&backend))?; 197 | file_data_save(curr_fp.as_str(), "curr").unwrap(); 198 | 199 | let sched_closure = move || { 200 | // append new chosen file name to the file 201 | // setting function will look at file name at bottom 202 | // and set accordingly. 203 | let filepath_set = update_wallpaper_days(&dir); 204 | let filepath_set = match filepath_set { 205 | Ok(s) => s, 206 | Err(e) => { 207 | eprintln!("{}", e); 208 | process::exit(1); 209 | } 210 | }; 211 | set_wallpaper(&filepath_set, Arc::clone(&progs), Arc::clone(&backend)).unwrap(); 212 | file_data_save(&filepath_set, "curr").unwrap(); 213 | }; 214 | sched_addto.run(sched_closure); 215 | } 216 | 217 | loop { 218 | scheduler.run_pending(); 219 | sleep(Duration::from_millis(1000)); 220 | } 221 | } 222 | 223 | fn commands_vec_loader( 224 | filepath_set: &str, 225 | progs: Arc>>, 226 | commands_vec: &mut Vec, 227 | ) { 228 | if let Some(prog_vec) = progs.as_deref() { 229 | for prog_str in prog_vec.iter() { 230 | let mut wall_sent = false; 231 | let mut prog_split = prog_str.split_whitespace(); 232 | let mut curr_command = Command::new(prog_split.next().unwrap()); 233 | for word in prog_split { 234 | //replacing !WALL with the filepath 235 | if word == "!WALL" { 236 | curr_command.arg(filepath_set); 237 | wall_sent = true; 238 | } else { 239 | curr_command.arg(word); 240 | } 241 | } 242 | //if the filepath has been placed previously, this ensures that we dont place it again at the end 243 | if wall_sent == false { 244 | curr_command.arg(filepath_set); 245 | } 246 | commands_vec.push(curr_command); 247 | } 248 | } 249 | } 250 | 251 | pub fn auto_time_setup(dir: &str) -> (Result, Time) { 252 | let dir_count = WalkDir::new(dir).into_iter().count() - 1; 253 | let step_time = if dir_count == 0 { 254 | Err(Errors::NoFilesFoundError(dir.to_string())) 255 | } else { 256 | Ok(Time::new(((24.0 / dir_count as f32) * 60.0) as u32)) 257 | }; 258 | let loop_time = Time::default(); 259 | 260 | (step_time, loop_time) 261 | } 262 | 263 | pub fn print_schedule(dir: &str, min_depth: usize, args: Args) -> Result<(), Box> { 264 | let mut dir_iter = sorted_dir_iter(dir, min_depth); 265 | let dir_count = sorted_dir_iter(dir, min_depth).count(); 266 | let mut sched_str: Vec = vec![]; 267 | let times = args.times.unwrap(); 268 | let mut times_iter = times.iter(); 269 | 270 | error_checking(×, times_iter.next(), dir_count, args.days)?; 271 | 272 | for time in times_iter { 273 | let file = dir_iter 274 | .next() 275 | .ok_or(Errors::ConfigFileError(ConfigFileErrors::FileTimeMismatch))??; 276 | let file = file.file_name(); 277 | sched_str.push(format!("Image: {:?} Time: {}", file, time.twelve_hour())); 278 | } 279 | 280 | for line in sched_str.iter() { 281 | println!("{}", line); 282 | } 283 | 284 | Ok(()) 285 | } 286 | 287 | pub fn sorted_dir_iter(dir: &str, min_depth: usize) -> walkdir::IntoIter { 288 | WalkDir::new(dir) 289 | .sort_by(|a, b| { 290 | alphanumeric_sort::compare_str( 291 | a.path().to_str().expect("Sorting directory files failed"), 292 | b.path().to_str().expect("Sorting directory files failed"), 293 | ) 294 | }) 295 | .min_depth(min_depth) 296 | .into_iter() 297 | } 298 | 299 | pub fn shuffled_dir_vec(dir: &str, min_depth: usize) -> Vec> { 300 | let mut rng = thread_rng(); 301 | let mut dir_vector: Vec<_> = WalkDir::new(dir).min_depth(min_depth).into_iter().collect(); 302 | dir_vector.shuffle(&mut rng); 303 | dir_vector 304 | } 305 | 306 | fn error_checking( 307 | times: &[Time], 308 | loop_time: Option<&Time>, 309 | dir_count: usize, 310 | days: Option, 311 | ) -> Result> { 312 | let times_iter_err = times.iter(); 313 | let start_range = times 314 | .iter() 315 | .next() 316 | .ok_or(Errors::ConfigFileError(ConfigFileErrors::Empty))?; 317 | let mut start_range_other = times.iter().next().unwrap(); 318 | let mut curr_range = start_range.to_owned(); 319 | let mut curr_range_other = start_range.to_owned(); 320 | let mut other_inited = false; 321 | let mut checked = vec![]; 322 | 323 | //loop through and error check. When time passes midnight, another loop is required in order to 324 | //start error checking those timings properly, to avoid the false error of the previous time 325 | //being greater than the next time 326 | for time in times_iter_err { 327 | if *time > *start_range && *time > curr_range { 328 | curr_range = *time; 329 | } else if *time > *start_range && *time < curr_range { 330 | return Err(Errors::ConfigFileError(ConfigFileErrors::OutOfOrder).into()); 331 | } else if *time < *start_range { 332 | if !other_inited { 333 | curr_range = FULL_DAY; 334 | start_range_other = time; 335 | curr_range_other = *time; 336 | other_inited = true 337 | } else if *time > *start_range_other && *time > curr_range_other { 338 | curr_range_other = *time; 339 | } else { 340 | return Err(Errors::ConfigFileError(ConfigFileErrors::OutOfOrder).into()); 341 | } 342 | } 343 | if time.total_mins >= 24 * 60 { 344 | return Err(Errors::ConfigFileError(ConfigFileErrors::OutOfRange).into()); 345 | } 346 | if checked.contains(time) { 347 | return Err(Errors::ConfigFileError(ConfigFileErrors::DuplicatesFound).into()); 348 | } 349 | checked.push(*time); 350 | } 351 | if times.len() != dir_count && days.is_none() { 352 | return Err(Errors::ConfigFileError(ConfigFileErrors::FileTimeMismatch).into()); 353 | } 354 | 355 | let loop_time = match loop_time { 356 | None => Err(Errors::ConfigFileError(ConfigFileErrors::Empty)), 357 | Some(time) => Ok(time), 358 | }?; 359 | Ok(*loop_time) 360 | } 361 | 362 | #[cfg(windows)] 363 | fn de_command_spawn( 364 | filepath_set: &str, 365 | backend: Arc>, 366 | ) -> Result<(), Box> { 367 | if backend.is_some() { 368 | eprintln!("NOTE: You are unable to select a backend on windows"); 369 | } 370 | unsafe { 371 | let file = OsStr::new(filepath_set) 372 | .encode_wide() 373 | // append null byte 374 | .chain(iter::once(0)) 375 | .collect::>(); 376 | let successful = SystemParametersInfoW( 377 | SPI_SETDESKWALLPAPER, 378 | 0, 379 | file.as_ptr() as *mut c_void, 380 | SPIF_UPDATEINIFILE | SPIF_SENDCHANGE, 381 | ) == 1; 382 | 383 | if successful { 384 | println!("{} has been set as your wallpaper", filepath_set); 385 | Ok(()) 386 | } else { 387 | Err(io::Error::last_os_error().into()) 388 | } 389 | } 390 | } 391 | 392 | #[cfg(not(windows))] 393 | fn de_command_spawn( 394 | filepath_set: &str, 395 | backend: Arc>, 396 | ) -> Result<(), Box> { 397 | let backend = backend.as_deref(); 398 | let gnome = vec![ 399 | UniCase::new("gnome"), 400 | UniCase::new("gnome-xorg"), 401 | UniCase::new("ubuntu"), 402 | UniCase::new("deepin"), 403 | UniCase::new("pop"), 404 | UniCase::new("ubuntu:gnome"), 405 | ]; 406 | let pantheon = UniCase::new("pantheon"); 407 | let mate = UniCase::new("mate"); 408 | let kde = vec![ 409 | UniCase::new("plasma"), 410 | UniCase::new("neon"), 411 | UniCase::new("kde"), 412 | UniCase::new("/usr/share/xsessions/plasma"), 413 | ]; 414 | let lxde = UniCase::new("lxde"); 415 | let xfce = vec![ 416 | UniCase::new("xfce"), 417 | UniCase::new("xubuntu"), 418 | UniCase::new("xfce session"), 419 | ]; 420 | 421 | let curr_de = env::var("XDG_CURRENT_DESKTOP"); 422 | let curr_de = match curr_de { 423 | Err(_) => String::from("Other"), 424 | Ok(de) => de, 425 | }; 426 | let mut curr_de = UniCase::new(curr_de.as_str()); 427 | 428 | let mut feh_handle = Command::new("feh"); 429 | let feh_handle = feh_handle.arg("--bg-scale").arg(filepath_set); 430 | 431 | //Gnome, Ubuntu, Deepin, Pop 432 | let mut gnome_handle = Command::new("gsettings"); 433 | let gnome_handle = gnome_handle 434 | .arg("set") 435 | .arg("org.gnome.desktop.background") 436 | .arg("picture-uri") 437 | .arg(format!("'file://{}'", filepath_set)); 438 | 439 | //Pantheon 440 | let mut multiarch_dir = String::from("/usr/lib/"); 441 | multiarch_dir.push_str(ARCH); 442 | multiarch_dir.push_str("-linux-gnu/"); 443 | let mut pantheon_handle = Command::new(multiarch_dir + "io.elementary.contract.set-wallpaper"); 444 | let pantheon_handle = pantheon_handle.arg(format!("{}", filepath_set)); 445 | 446 | //kde 447 | let kde_script_beg = r#" 448 | qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript " 449 | var allDesktops = desktops(); 450 | print (allDesktops); 451 | for (i=0;i = vec![]; 484 | 485 | let mut cust_backend = false; 486 | if let Some(back) = backend { 487 | curr_de = UniCase::new(back); 488 | cust_backend = true; 489 | for word in back.split_whitespace() { 490 | backend_split.push(word); 491 | } 492 | } 493 | 494 | if gnome.contains(&curr_de) { 495 | gnome_handle 496 | .spawn() 497 | .map_err(|_| Errors::ProgramRunError(String::from("Gnome Wallpaper Adjuster")))?; 498 | } else if lxde == curr_de { 499 | lxde_handle 500 | .spawn() 501 | .map_err(|_| Errors::ProgramRunError(String::from("LXDE Wallpaper Adjuster")))?; 502 | } else if pantheon == curr_de { 503 | pantheon_handle 504 | .spawn() 505 | .map_err(|_| Errors::ProgramRunError(String::from("Pantheon Wallpaper Adjuster")))?; 506 | } else if mate == curr_de { 507 | mate_handle 508 | .spawn() 509 | .map_err(|_| Errors::ProgramRunError(String::from("Mate Wallpaper Adjuster")))?; 510 | } else if kde.contains(&curr_de) { 511 | run_script::run(kde_script.as_str(), &vec![], &ScriptOptions::new()) 512 | .map_err(|_| Errors::ProgramRunError(String::from("KDE Wallpaper Adjuster")))?; 513 | } else if xfce.contains(&curr_de) { 514 | run_script::run(xfce_script.as_str(), &vec![], &ScriptOptions::new()) 515 | .map_err(|_| Errors::ProgramRunError(String::from("XFCE Wallpaper Adjuster")))?; 516 | } else if !cust_backend || curr_de == UniCase::new("feh") { 517 | feh_handle 518 | .spawn() 519 | .map_err(|_| Errors::ProgramRunError(String::from("Feh")))?; 520 | } else if cust_backend { 521 | let mut backend_split = backend_split.into_iter(); 522 | let mut cust_handle = Command::new(backend_split.next().unwrap()); 523 | let mut wall_sent = false; 524 | for word in backend_split { 525 | if word == "!WALL" { 526 | wall_sent = true; 527 | cust_handle.arg(filepath_set); 528 | } else { 529 | cust_handle.arg(word); 530 | } 531 | } 532 | 533 | if !wall_sent { 534 | cust_handle.arg(filepath_set); 535 | } 536 | 537 | cust_handle 538 | .spawn() 539 | .map_err(|_| Errors::ProgramRunError(curr_de.to_string()))?; 540 | } else { 541 | return Err(Errors::BackendNotFoundError(curr_de.to_string()).into()); 542 | } 543 | 544 | println!("{} has been set as your wallpaper", filepath_set); 545 | Ok(()) 546 | } 547 | 548 | pub fn sun_timings( 549 | dir: &str, 550 | lat: f64, 551 | long: f64, 552 | elevation: f64, 553 | ) -> Result, Box> { 554 | let dir_night = format!("{}/night", dir); 555 | let dir_night = dir_night.as_str(); 556 | let dir_day = format!("{}/day", dir); 557 | let dir_day = dir_day.as_str(); 558 | let (dir_count_day, dir_count_night) = sun_timings_dir_counts(dir, dir_day, dir_night)?; 559 | if dir_count_day == 0 { 560 | return Err(Errors::NoFilesFoundError(String::from(dir_day)).into()); 561 | } else if dir_count_night == 0 { 562 | return Err(Errors::NoFilesFoundError(String::from(dir_night)).into()); 563 | } 564 | let mut times: Vec