···11# rainwall
22+23
3445**rainwall is a program to set your wallpaper based on the weather outside.**
5667## but how?
77-This application uses ImageMagick to identify the dominant colour of an image using the Kmeans algorithm in the Oklch colourspace. Once a dominant colour is found, a wallpaper is chosen by identifying the current shortwave radiation, cloud cover, and sun angle, which correspond to lightness, chroma, and hue respectively.
88+99+This application uses ImageMagick to identify the dominant colour of an image using the Kmeans algorithm in the Oklch
1010+colourspace. Once a dominant colour is found, a wallpaper is chosen by identifying the current shortwave radiation,
1111+cloud cover, and sun angle, which correspond to lightness, chroma, and hue respectively.
812913## dependencies
1414+1015- [ImageMagick](https://imagemagick.org)
11161217## installing
1313-First, install [ImageMagick](https://imagemagick.org) using your method of choice. Then download the binary from [Releases on GitHub](https://github.com/weightedangelcube/rainwall/releases), or get it from [JSR](https://jsr.io/@angelcube/rainwall/).
1818+1919+First, install [ImageMagick](https://imagemagick.org) using your method of choice. Then download the binary from
2020+[Releases on GitHub](https://github.com/weightedangelcube/rainwall/releases), or get it from
2121+[JSR](https://jsr.io/@angelcube/rainwall/).
14221523Alternatively, if you are using Arch Linux, you can use the PKGBUILD in the repository root to do both for you.
16241725## usage
1818-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.
1919- - Linux: `$XDG_CONFIG_HOME/rainwall` or `~/.config/rainwall`
2020- - Darwin (macOS/OSX): `~/Library/Preferences/rainwall`
2121- - Windows: `%LocalAppData%/rainwall`
2626+2727+1. Give both `rainwall-analyze` and `rainwall-apply` an initial run to generate the config files, then edit the config
2828+ files as needed. See below for configuration options.
2929+ - Linux: `$XDG_CONFIG_HOME/rainwall` or `~/.config/rainwall`
3030+ - Darwin (macOS/OSX): `~/Library/Preferences/rainwall`
3131+ - Windows: `%LocalAppData%/rainwall`
22322. Run `rainwall-analyze` to generate the index of image colours. This will take a while, be patient!
23333. Run `rainwall-apply` to set your wallpaper! Enjoy!
24342535## configuring
3636+2637### `analyze-config.json`
3838+2739| option | typeof | default | description |
2828-|-----------------------|------------|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
4040+| --------------------- | ---------- | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2941| `imageDir` | `string` | `/home/<yourusername>/Pictures` | The directory where your image files are stored. |
3042| `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. |
31433244### `apply-config.json`
4545+3346| option | typeof | default | description |
3434-|-------------------------|----------------------------------|------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
4747+| ----------------------- | -------------------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
3548| `latitude` | `number` | `0` | The latitude used to discover the weather outside. |
3649| `longitude` | `number` | `0` | The longitude used to discover the weather outside. |
3750| `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. |
3851| `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. |
3952| `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. |
4040-| `applyWallpaperCommand` | `string` | `hyprctl hyprpaper wallpaper , %s` | The command used to apply the wallpaper. See "applying the wallpaper" section below for more info. |
5353+| `applyWallpaperCommand` | `string` | `hyprctl hyprpaper wallpaper , %s` | The command used to apply the wallpaper. See "applying the wallpaper" section below for more info. |
41544255## applying the wallpaper
5656+4357Put `%s` where the image path would normally go.
5858+4459### Linux
6060+4561- GNOME (untested):
4646- - Light theme: `gsettings set org.gnome.desktop.background picture-uri file://%s`
4747- - Dark theme: `gsettings set org.gnome.desktop.background picture-uri-dark file://%s`
6262+ - Light theme: `gsettings set org.gnome.desktop.background picture-uri file://%s`
6363+ - Dark theme: `gsettings set org.gnome.desktop.background picture-uri-dark file://%s`
4864- KDE Plasma (untested):
4949- - `plasma-apply-wallpaperimage %s`
6565+ - `plasma-apply-wallpaperimage %s`
5066- awww (untested)
5151- - `awww img %s`
6767+ - `awww img %s`
5268- swaybg (untested)
5353- - `swaybg -i %s`
6969+ - `swaybg -i %s`
5470- hyprpaper
5555- - `hyprctl hyprpaper wallpaper , %s`
7171+ - `hyprctl hyprpaper wallpaper , %s`
56725773### Darwin (macOS/OSX)
7474+5875<sub>(untested, [source](https://discussions.apple.com/thread/254859103))</sub>
59766060-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:
6161-`automator -i "%s" /path/to/your.workflow`
7777+Launch Automator. Click New Document → Choose. From the "Files & Folders" library, drag and drop the "Set the Desktop
7878+Picture" action to the right onto the larger workflow window. Save it somewhere accessible. Then, put this into the
7979+config file: `automator -i "%s" /path/to/your.workflow`
62806381### Windows
8282+6483...who knows?
65846685## compatibility
8686+6787- Linux ✅
6888- Darwin (macOS/OSX) ❓
6989- Windows ❌
7070- - [ ] How does one set the wallpaper via CLI?
7171- - [ ] `apply/index.ts @ L80, analyze/analysis.ts @ L20`: equivalent of POSIX eval?
7272-9090+ - [ ] How does one set the wallpaper via CLI?
9191+ - [ ] `apply/index.ts @ L80, analyze/analysis.ts @ L20`: equivalent of POSIX eval?