Skip to content

Simple script to change colors automatically in an attempt to match an image, which it will call a command to set as the desktop background

License

Notifications You must be signed in to change notification settings

nate-byrnes/fvwm-autocolor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fvwm-autocolor

Simple script to change colors automatically in an attempt to match an image, which it will call a command to set as the desktop background

Installation

git clone /~https://github.com/nate-byrnes/fvwm-autocolor.git
cd fvwm-autocolor
cp autotheme.py ${HOME}/.fvwm/
pip install -r requirements.txt

FVWM Integration

The script operates on the the following environment variables:

  1. DISPLAY
  2. FVWM_USERDIR (set by FVWM, but cron won't see it ...)
  3. FAT_IMG_DIR (defaults to ${FVWM_USERDIR}/bg}, where random mode will pick images from)
  4. FAT_CACHE_DIR (defaults to ${FAT_IMG_DIR}, where extracted colors are cached, mapped to filename.colors)
  5. FAT_SWATCH_DIR (defaults to ${FAT_CACHE_DIR}, where extracted swatches can be stored, also, mapped to filename)
  6. FAT_SAVE_SWATCH (Defaults to 0 for disabled, 1 to enable the saving of extraced swatches)
  7. FAT_FVWMCOMMAND (defaults to /usr/bin/FvwmCommand, used to tell FVWM the changes to the colorsets)
  8. FAT_BG_COMMAND (defaults to '/usr/bin/feh --bg-tile --zoom 100 -D 3 -z' to set the desktop background)
  9. FAT_INACT_COLORSETS (default '0,1,3,5,7' the numbers of the inactive colorsets to modify)
  10. FAT_ACTIVE_COLORSETS (default '2,4,6,8' the numbers of the active colorsets to modify)

Configuration notes: Need to have FvwmCommandS module running so that FvwmCommand can communicate with the window manager.

Here is a simple function that can be added to menu items or decoration buttons or wherever to trigger a new "auto theme" based upon a randomly selected image:

# Random Background Function
DestroyFunc FuncRandTheme
AddToFunc   FuncRandTheme
+ I Exec exec python $[FVWM_USERDIR]/autotheme.py

And, to start with a specific theme add the following to the start:

# Use a specific image file (in this case square-tiles.jpg) to autotheme from
AddToFunc   StartFunction
+ I Module FvwmCommandS
+ I Test (x $[FVWM_USERDIR]/autotheme.py) Exec exec $[FVWM_USERDIR]/autotheme.py $[FVWM_USERDIR]/bg/square-tiles.jpg

Screenshots

Tile

grey

Blossom Tree

Green

TODO

  1. Add some logic to force a bit more contrast, especially when dealing with repetitions and very dark colors
  2. Develop way to detect and separate text that blends into BG
  3. Maybe grab more than just 4 colors from image and find a clever way to auto select them...

About

Simple script to change colors automatically in an attempt to match an image, which it will call a command to set as the desktop background

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages