···11+# rainwall
22+
33+44+**rainwall is a program to set your wallpaper based on the weather outside.**
55+66+## dependencies
77+- [ImageMagick](https://imagemagick.org)
88+99+## usage
1010+1. Give both `rainwall-analyze` and `rainwall-apply` an initial run to generate the config files, then edit the config files as needed. See below for configuration options.
1111+ - Linux: `$XDG_CONFIG_HOME/rainwall` or `~/.config/rainwall`
1212+ - Darwin (macOS/OSX): `~/Library/Preferences/rainwall`
1313+ - Windows: `%LocalAppData%/rainwall`
1414+2. Run `rainwall-analyze` to generate the index of image colours. This will take a while, be patient!
1515+3. Run `rainwall-apply` to set your wallpaper! Enjoy!
1616+1717+## configuring
1818+### `analyze-config.json`
1919+| option | typeof | default | description |
2020+|-----------------------|------------|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
2121+| `imageDir` | `string` | `/home/<yourusername>/Pictures` | The directory where your image files are stored. |
2222+| `preAnalysisCommands` | `string[]` | `[]` | An array of commands to perform before analysis begins. Examples include applying CLUTs, adjusting HSV, etc. All commands will be properly escaped. **Warning: commands are run directly with `eval`! Don't put anything potentially unsafe...** or do, we don't care. |
2323+2424+### `apply-config.json`
2525+| option | typeof | default | description |
2626+|-------------------------|----------------------------------|------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
2727+| `latitude` | `number` | `0` | The latitude used to discover the weather outside. |
2828+| `longitude` | `number` | `0` | The longitude used to discover the weather outside. |
2929+| `weatherModel` | `string` | `"best_match"` | The weather model to calculate cloud cover and shortwave radiation with. Find the options on the [Open-Meteo](https://open-meteo.com/en/docs) site. |
3030+| `lightnessRange` | `{ start: number; end: number }` | `{ start: 0; end: 1 }` | The range of lightness values to map shortwave radiation to. Use this if your images are all exceptionally light or dark, due to post-processing or other reasons. |
3131+| `chromaRange` | `{ start: number; end: number }` | `{ start: 0; end: 1 }` | The range of chroma values to map cloud cover to. Use this if your images are all exceptionally saturated or desaturated, due to post-processing or other reasons. |
3232+| `applyWallpaperCommand` | `string` | `hyprctl hyprpaper wallpaper , %s` | The command used to apply the wallpaper. See "applying the wallpaper" section below for more info. |
3333+3434+## applying the wallpaper
3535+Put `%s` where the image path would normally go.
3636+### Linux
3737+- GNOME (untested):
3838+ - Light theme: `gsettings set org.gnome.desktop.background picture-uri file://%s`
3939+ - Dark theme: `gsettings set org.gnome.desktop.background picture-uri-dark file://%s`
4040+- KDE Plasma (untested):
4141+ - `plasma-apply-wallpaperimage %s`
4242+- awww (untested)
4343+ - `awww img %s`
4444+- swaybg (untested)
4545+ - `swaybg -i %s`
4646+- hyprpaper
4747+ - `hyprctl hyprpaper wallpaper , %s`
4848+4949+### Darwin (macOS/OSX)
5050+<sub>(untested, [source](https://discussions.apple.com/thread/254859103))</sub>
5151+5252+Launch Automator. Click New Document โ Choose. From the "Files & Folders" library, drag and drop the "Set the Desktop Picture" action to the right onto the larger workflow window. Save it somewhere accessible. Then, put this into the config file:
5353+`automator -i "%s" /path/to/your.workflow`
5454+5555+### Windows
5656+...who knows?
5757+5858+## compatibility
5959+- Linux โ
6060+- Darwin (macOS/OSX) โ
6161+- Windows โ
6262+ - [ ] How does one set the wallpaper via CLI?
6363+ - [ ] `apply/index.ts @ L80, analyze/analysis.ts @ L20`: equivalent of POSIX eval?
+2-2
deno.json
···11{
22 "tasks": {
33- "compile-analyze": "deno compile --output build/analyze -A analyze/index.ts",
44- "compile-apply": "deno compile --output build/apply -A apply/index.ts",
33+ "compile-analyze": "deno compile --output build/rainwall-analyze -A analyze/index.ts",
44+ "compile-apply": "deno compile --output build/rainwall-apply -A apply/index.ts",
55 "analyze": "deno run -A analyze/index.ts",
66 "apply": "deno run -A apply/index.ts"
77 },