I have a lot of wallpapers I like, and I like to have my applications match some of the dominate colors of the wallpaper. I have previously used some scripts and gvcci to generate themes I can load into my terminal and preferred WM.
It worked well for a while, but I’ve accrued too many wallpapers that it’s kind of a lot to bring between the machines I use day to day. It’s also pretty hard to update templates that the scripts use. Changing theme requires re-generating all the themes as I have it.
I could probably make my script work better, but I thought an improvement and fun project would be to convert this script into a REST api. I could store wallpaper on a server and feed it my template files and get back themes and wallpapers where ever I liked.
My goal for this project is to write a web api in rust that can:
- Receive wallpapers via a put request, generating a couple color themes
- Search for wallpapers
- Get filled in template given some wallpaper id and a template
I plan to put my work in this repo
I’ve been working a lot on this, but I’ve been procrastinating on updating this post.
The REST API in rust ended up being a bit easier than I thought it would.
I decided to use diesel to store my data in a database and warp to handle the http requests.
Since I chose to use diesel, I also ended up using postgres as my database. A lot of the documentation used postgres so it made sense to me.
I got some endpoints whipped up that allowed to me get/post wallpapers and their themes, as well as template files with the theme’s color schemes.
As part of my work, I also created a Dockerfile and docker-compose file so I could get a quick development environment. It’s worked well so far, and should make for migrating it to some real server a bit easier.
Since I got the server done quicker than I thought, I decided to expand the scope to include a minimally functional front end app I could use to browse the wallpapers/themes and apply them.
I had a small amount of experience with angular and figured if I used angular and something like electron, I could make two versions of the front end pretty easily. One hosted on the server to browse the wallpapers, and another application that could also apply the themes.
I managed to get the electron & angular application to show the wallpapers and themes I had in the server, but it still needs a lot of styling and the ability to apply themes.
I’m going to continue working and hopefully get a frontend app that looks a bit cleaner, and can apply the themes.
This is my last update on this project, I think I’m at a good stopping point. I’ve gotten it styled up a bit better. It could probably look nicer, but it looks like how I imagined it looking originally. The app can now template my configuration files and run scripts to apply them. I had some troubles with asynchronous functions, but in the end I got it working.
A demo of it in action:
I also got the server version of my angular frontend stood up in a linode instance here. It’s nearly identical to the electron app, but it doesn’t have the apply button.
There’s a lot more I want to get done with this, but I think it will fall out of devember. I’m pretty pleased with how it turned out, and I look forward to improving it more.