Skip to content

Commit

Permalink
Porting to RUST!
Browse files Browse the repository at this point in the history
  • Loading branch information
Pitasi committed Dec 30, 2018
1 parent 3eb7ddc commit 52b22b1
Show file tree
Hide file tree
Showing 9 changed files with 1,584 additions and 64 deletions.
831 changes: 831 additions & 0 deletions Cargo.lock

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "dyn-wallpaper"
version = "0.1.0"
edition = "2018"
authors = ["Antonio Pitasi <pitasi.antonio@gmail.com>"]

[profile.dev]
opt-level = 2
debug-assertions = true

[dependencies]
strfmt = "0.1.6"
chrono = "0.4.6"
clap = "2.26.0"
indicatif = "0.9.0"
sun-times = "0.1.2"
csv = "1"
image = "0.20.1"
alphanumeric-sort = "1.0.6"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["winuser"] }
92 changes: 28 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,57 @@
# Emulate macOS Mojave's dynamic wallpaper

## What you get

![Dyn Wallpaper](https://i.imgur.com/0rJw98D.gif)

## Why

Yeah, since the first time I looked at Mojave's dynamic wallpaper I fell in
love with them.

That's why I've done a pretty simple script to use their images on a Linux
environment. As I'm using i3wm with `feh`, the default command used to set the
wallpaper, but you may change it in order to work with Gnome, KDE, or whatever
you wish.
I wrote this little utility to periodically change wallpaper while blending the
images together based on the current time, relative to sunrise/sunset.

This script also supports Windows.
I tested this on **Arch Linux** and **Windows 10**.
*Mac OS support has not been tested yet.*

# Requirements
Python 3, and some Python packages you can find in
[requirements.txt](requirements.txt): install them with pip:
```sh
$ pip install -r requirements.txt
```

# How to
# Requirements

First of all, download the source Mojave images (I'm not going to upload them
in this repository in order to avoid copyright problems) from
Download the source Mojave images (I'm not going to upload them in this
repository in order to avoid copyright problems) from
[the internet](https://www.reddit.com/r/apple/comments/8oz25c/all_16_full_resolution_macos_mojave_dynamic/).

Clone/download this repository to get the `set_wallpaper.py` and install the
[requirements](#requirements).

Extract the images in a folder, i.e. `~/Images/Wallpapers`.

```sh
$ python set_wallpaper.py Rome ~/Images/Wallpapers
```

You can find a list of valid city names [here](https://astral.readthedocs.io/en/latest/#cities).
# How to use this

# Configuration
```sh
$ python set_wallpaper.py -h

usage: set_wallpaper.py [-h] [-r RATE] [-t TEMP] [-i DUSK_ID] [-c COMMAND]
city folder

Live wallpaper based on Sun position, emulating Mac OS Mojave "dynamic
wallpaper".

positional arguments:
city Timezone city to be used when calculating sunset time
(i.e. Rome) see
https://astral.readthedocs.io/en/latest/#cities for a
list of valid names.
folder Folder containing the different wallpapers.

optional arguments:
-h, --help show this help message and exit
-r RATE, --rate RATE Refresh rate in minutes (default 10).
-t TEMP, --temp TEMP Temp image file (default /tmp/wallpaper.png).
-i DUSK_ID, --dusk-id DUSK_ID
Image number of the "dusk" image (default to 13 for
the 16-images Apple set).
-c COMMAND, --command COMMAND
Command to be executed for setting the wallpaper, use
"{}" as a placeholder for the image (default: "feh
--bg-scale {}").
From the [release page](https://github.com/Pitasi/dyn-wallpaper/releases)
download the latest binary for your platform (Linux, Mac OS, or Windows).

Run it from a terminal (or command prompt if you prefer):
```sh
$ ./dyn-wallpaper "Rome" "~/Images/Wallpapers"
```

# Examples for different DE
If you use a different Desktop Environment and want to add the command to this
list just fill an issue or send a PR!
You can find a list of valid city names [here](https://astral.readthedocs.io/en/latest/#cities).

## Default (feh and Windows)
```sh
$ python set_wallpaper.py Rome ~/Images/Wallpapers
```

## Gnome
```sh
$ python set_wallpaper.py Rome ~/Images/Wallpapers -c "gsettings set org.gnome.desktop.background picture-uri {}"
```
# Contributing

## Plasma / KDE 5
I didn't find a good way to do it for now. Sorry.
Issues and PRs are welcome. Go ahead!

You're gonna need Rust (with Cargo) to easily edit and build the sources.


# Contributing
## Build the project
```sh
$ git clone https://github.com/Pitasi/dyn-wallpaper

Issues and PRs are welcome. Go ahead!
# Test it
$ cargo run "Rome" "~/Images/Wallpapers"

# Build it
$ cargo build --release
```
Loading

0 comments on commit 52b22b1

Please sign in to comment.