Automating Linux Desktop Theming With Chameleon
In my previous posts, I have mentioned my use of tools like pywal to automatically generate colorschemes for my terminal based programs.
Since then, I have developed a couple scripts that extend these colorschemes to programs I use regularly.
At that time, my solution to dynamic configuration generartion was to replace the program executable with my own executable, which would generate a configuration on the fly and then launch the intended program.
However, after gathering enough wal plugins, I realized I no longer had a one command solution to theme my system. Wal worked as intended, but I would manually generate GTK themes with oomox, and run commands to generate new skins for programs like Steam and Spotify.
I finally caved and decided it was time for a script to handle all this tedium. Chameleon is that script.
Chameleon works by putting the desired desktop background through wal
, and then using the palette generated by wal, creates themes and colorschemes for all supported programs detected on the users system.
For example, if the user has installed Zathura-Pywal, A new zathura configuration file will be generated for this colorscheme. This means the user can run the zathura
command to launch the program, instead of the zth
command I had previously implemented to hook into the colorschemes.
While not every plugin works seamlessly to theme their intended programs, (see issues I have opened in various repos) My script detects if you are trying to use them (with some configuration required) and runs the appropriate commands.
For a full and up to date list of supported programs, see the github repo. In the mean time, feel free to submit a feature request (or even better, a pull request 😄)
Here is some sample output of the script running
#######################
# Running Wal On Image#
#######################
[I] image: Using image acastro_190117_dekstop_wallpaper.0.jpg.
[I] theme: Set theme to _home_gideon_Wallpapers_acastro_190117_dekstop_wallpaper_0_jpg_dark_None_None_1.1.0.json.
[I] colors: Found cached colorscheme.
[I] wallpaper: Set the new wallpaper.
[I] sequences: Set terminal colors.
[I] export: Exported all files.
[I] export: Exported all user files.
[I] reload: Reloaded environment.
##########################
# Updating Zathura Color #
##########################
Zathura Theme Set
##########################
# Updating Gnuplot Color #
##########################
Gnuplot Theme Set
##########################
# Updating GTK theme #
##########################
Building theme at /home/gideon/.themes/oomox-xresources-dark
rm -rf "gtk-3.0/dist"
rm -f "gtk-3.0/gtk.gresource"
rm -rf "gtk-3.20/dist"
rm -f "gtk-3.20/gtk.gresource"
rm -rf "/home/gideon/.themes/oomox-xresources-dark/dist"
mkdir -p gtk-3.0/dist
sassc -I "gtk-3.0/scss" "gtk-3.0/scss/gtk.scss" "gtk-3.0/dist/gtk.css"
sassc -I "gtk-3.0/scss" "gtk-3.0/scss/gtk-dark.scss" "gtk-3.0/dist/gtk-dark.css"
glib-compile-resources --sourcedir="gtk-3.0" "gtk-3.0/gtk.gresource.xml"
mkdir -p gtk-3.20/dist
sassc -I "gtk-3.20/scss" "gtk-3.20/scss/gtk.scss" "gtk-3.20/dist/gtk.css"
sassc -I "gtk-3.20/scss" "gtk-3.20/scss/gtk-dark.scss" "gtk-3.20/dist/gtk-dark.css"
glib-compile-resources --sourcedir="gtk-3.20" "gtk-3.20/gtk.gresource.xml"
mkdir -p cinnamon
sassc -I "cinnamon/scss" "cinnamon/scss/cinnamon.scss" "cinnamon/cinnamon.css"
#######################
# Updating Icon theme #
#######################
== Template was copied to /home/gideon/.icons/oomox-xresources-dark-flat
== Theme was generated
Icon Theme Generated
##########################
# Updating Telegram Skin #
##########################
:: Palette generated succesfully.
#######################
# Updating Steam Skin #
#######################
Wal Steam cache found
Wal Steam config found
Wal Steam skin found
Reading colors
Patching new colors
No file to remove
Wal colors are now patched and ready to go
If this is your first run you may have to
enable Metro Wal Mod skin in steam then
simply restart steam!
###########################
# Updating Keyboard Color #
###########################
Keyboard Color Set
##########################
# Updating Spotify Color #
##########################
about.spa
artist.spa
browse.spa
buddy-list.spa
chart.spa
collection-album.spa
collection-artist.spa
collection-songs.spa
collection.spa
concert.spa
concerts.spa
error.spa
findfriends.spa
full-screen-modal.spa
genre.spa
glue-resources.spa
hub.spa
licenses.spa
login.spa
lyrics.spa
playlist-folder.spa
playlist.spa
profile.spa
queue.spa
search.spa
settings.spa
show.spa
station.spa
stations.spa
zlink.spa
[sudo] password for gideon:
Spotify Theme Set
##################################
# Updating IntelliJ Color Scheme #
##################################
IntelliJ Theme Set