Skip to content

Script to periodically generate random desktop images with Tang poetry.

Notifications You must be signed in to change notification settings

yankihue/300Tang-Script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

300Tang-Script

This is a python script that I use on my desktop. It randomly picks one of the famous 320 Tang poems and displays it on top of a painting. I used this resource to get all 320 poems in JSON format. A new wallpaper will be generated overriding the old one every minute (by default).

Screenshot

Usage

For GNOME:

Clone the repo.

cd ~/Desktop
git clone https://github.com/yankihue/300Tang-Script 300Tang

If you want to put it anywhere else, you should change main.py and point it at that directory(change this line). By default the script points at desktop, inside the folder 300Tang.

You need the WQY Microhei font for this to work. To install:

sudo apt-get install ttf-wqy-microhei 

Get poetry if you don't have it:

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3

Afterwards, if you want to test the script first, run

poetry install

at the base directory of the project.

Then run

poetry shell
cd 300tang
python3 main.py

I use drop down terminal to manually start it after boot like this, and just leave that terminal to run it. That way, you don't have to create a .desktop file, have a terminal tab open always, etc. If you would like everything to be handled automatically from boot, keep reading:

Automating it

If you would like the script to automatically run on the background starting from boot, add a .desktop file like below to /home/your_name/.config/autostart/

[Desktop Entry]
Encoding=UTF-8
Name=300Tang
Comment=Random wallpaper generator.
Icon=gnome-info
Exec=gnome-terminal -x bash -c "cd ~/Desktop/300Tang/300tang && python3 main.py exec bash"
Terminal=false
Type=Application
Categories=

X-GNOME-Autostart-enabled=true
X-GNOME-Autostart-Delay=10

if you placed the project in another directory, modify the Exec=cd .../300Tang/300tang path. If its in your desktop, you can use this one without modifying. Just copy it to /home/your_name/.config/autostart/300Tang.desktop

TODO

  • Make .service file and use systemctl to run script without terminal
  • Add more base images
  • Add English and Pinyin

About

Script to periodically generate random desktop images with Tang poetry.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages