Skip to content

scheme: Add user-defined schemes with dynamic fallback - #121

Open
XLhinares wants to merge 3 commits into
caelestia-dots:mainfrom
XLhinares:manual-scheme
Open

scheme: Add user-defined schemes with dynamic fallback#121
XLhinares wants to merge 3 commits into
caelestia-dots:mainfrom
XLhinares:manual-scheme

Conversation

@XLhinares

@XLhinares XLhinares commented Jun 14, 2026

Copy link
Copy Markdown

This PR adds a new scheme: manual.

Why

The dynamic scheme works nicely with some wallpapers, and with others I like to use my own scheme. However, if I use a custom scheme, it stays on when I change my wallpaper, which is not ideal either.

Additionally, overwriting the scheme file with a posthook script is not a good option since other scripts watching wallpaper change will use the scheme before it is overwritten.

How

The manual scheme checks if the user has a custom scheme file for the current wallpaper at the path ~/.config/caelestia/schemes/<wallpaper_name>.txt.
If that file exists, then it is used as the theme; otherwise, the dynamic scheme is used.

Notes

  • The user needs to create ~/.config/caelestia/schemes/ to put their custom schemes.
  • The <wallpaper_name> also contains the file extension (so the scheme name will end up like my_wallpaper.png.txt)
  • If the user has two wallpapers with the same name and extension, they will use the same manual scheme, but I don't think that's an issue.
  • Manual scheme has the same flavors as dynamic, but doesn't directly use them (they are used when the scheme falls back to dynamic)

@XLhinares XLhinares changed the title Add user-defined schemes with dynamic fallback scheme: Add user-defined schemes with dynamic fallback Jun 14, 2026
@XLhinares

Copy link
Copy Markdown
Author

I changed the way the schemes are looked up: the cli now use a json file (~/.config/caelestia/manual-schemes.json) to match wallpaper name and scheme path.

Advantages:

  • This allows user to reuse themes more easily
  • The config folder is less clutered (one json vs a dir full of schemes)
  • The user can store schemes wherever

Example json:

{
  "978293.png": "~/.config/caelestia/schemes/black-gold-scheme.txt",
  "abstract-black-gold.png": "~/.config/caelestia/schemes/black-gold-scheme.txt",
  "abstract-black-purple.png": "~/.config/caelestia/schemes/abstract-black-purple.png.txt"
}

@XLhinares

XLhinares commented Jun 15, 2026

Copy link
Copy Markdown
Author

Last commit introduced regex matching.
The manual scheme strategy is now:

  • If the exact wallpaper file name is a key in the json, use the matching scheme,
  • Otherwise, if the wallpaper path matches a regex pattern in the json, use that scheme,
  • If neither match, fallback to the dynamic scheme

Example json:

{
  "978293.png": "~/.config/caelestia/schemes/black-gold-scheme.txt",
  "abstract-black-gold.png": "~/.config/caelestia/schemes/black-gold-scheme.txt",
  "abstract-black-purple.png": "~/.config/caelestia/schemes/abstract-black-purple.png.txt",
  "Wallpapers/dark/": "~/Downloads/dark-scheme.txt",
  ".*": "~/.config/caelestia/schemes/default.txt"
}

Note:

  • if several regex match the wallpaper path, the first one is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant