A python script to generate wallpaper that shows time in binary.
Example picture when the time is 7:39 PM:
As you can see from the annotated picture below, the clock shows 0111 100111 1
in binary. If you convert it to decimal you will get
4+2+1 32+4+2+1 1
which means 7:39 PM
.
![annotated-example](https://private-user-images.githubusercontent.com/32161460/261795504-8a53b6ef-550b-451b-bfa5-059f41eafe08.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNTU2MTMsIm5iZiI6MTczOTE1NTMxMywicGF0aCI6Ii8zMjE2MTQ2MC8yNjE3OTU1MDQtOGE1M2I2ZWYtNTUwYi00NTFiLWJmYTUtMDU5ZjQxZWFmZTA4LmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDAyNDE1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA3NjZmOTIwZTU1MGRmMzhhZThmMTQ4YjMxZTZmNjcyYjdiODQzMDgzOWY4ZDc4MWUzN2RlYjM1NDVlOTRkMTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.6MOS5t3T3aNuYUMgq7ArNDZRrD6GUD_fn3rw3FvIC8A)
First create a virtual environment for python and activate it:
python3 -m venv venv
source venv/bin/activate
Then install dependencies with:
pip3 install -r requirements.txt
Run the following command and a file named result.png
will be created under img
directory. You can use that file to set your wallpaper.
python3 binary_clock_wallpaper.py
You can change any color to match it with your environment. A color can be either hex value or a generic color name.
python3 binary_clock_wallpaper.py --accent-color "#35d8dd"
python3 binary_clock_wallpaper.py --accent-color steelblue --wire-color gray --bg-color "#0f0f17"
Default is 24-hour time. Change it like this if you want to use 12-hour time:
python3 binary_clock_wallpaper.py --use-12-hour
You can run the helper script, set_binary_wallpaper.sh
, as a cronjob to update your wallpaper every minute. The helper script uses nitrogen
as wallpaper setter. Do not forget to change it if you use another program.
# Run "crontab -e" and add the following line to that file.
* * * * * /path/to/set_binary_wallpaper.sh
Tip: All the arguments passed to this script will be passed to python. So you can do the following to see the changes immediately while tweaking the colors:
./set_binary_wallpaper.sh --accent-color greenyellow --wire-color gray
Gruvbox | Dracula | Nord |
---|---|---|
![]() |
![]() |
![]() |
You can find the actual design files in svg
directory. If you are not happy about the current design or resolution you can modify those files using Inkscape (or a similar program) and create your own design.
- Jake@Linux for giving me an inspiration to write this script with one of his videos.
- @loicreynier for adding accent color support.