How I made my desktop wallpaper a bit more productive
I am a minimalist when it comes to my PC desktop. I set a simple wallpaper, keep nothing but the things I work on at the moment and move things periodically to make the desktop clutter free. This keeps me focused when I am sitting in front of my PC.
Lately I have been pondering about having the list of tasks I am currently working on as a part of wallpaper. This will keep me reminded. So I put together a small script that will do that.
The ideas is to
- Have a base image to be used as background
- Figure out where the texts to be added
- Have a list of tasks stored in a file
- Open the file, parse the tasks, add those as texts to the image using Python
- Save the file and set that as wallpaper
I have a 1920 x 1080 size monitor. So I downloaded this image from unsplash and cropped it using paint with dimensions of my screen. I added a text called todo at a place where I intended to add the list of tasks. I downloaded the IndieFlower font from Google fonts and placed inside the same directory. Then I created a text file with list of tasks. The code is as below
from PIL import Image, ImageFont, ImageDraw
import ctypes
import os
filename = 'tasks.txt'
with open(filename) as file:
tasks = file.readlines()
my_image = Image.open("base.jpg")
title_font = ImageFont.truetype('IndieFlower.ttf', 40)
image_editable = ImageDraw.Draw(my_image)
#Location of the text from top left corner
base_y = 630
base_x = 1000
tasks = [task.replace('\n', "") for task in tasks]
for i in range(len(tasks)):
image_editable.text((base_x, base_y), str(i+1)+". " + tasks[i],
(105, 96, 96), font=title_font)
base_y += 60
my_image.save("result.jpg")
image_path = os.path.join(os.getcwd(), 'result.jpg')
#Changing the wallpaper
ctypes.windll.user32.SystemParametersInfoW(20, 0, image_path, 1)
The complete code can be found in this repo
Future Todo : Make this program run on system startup and also automatically run when I change something in the text file.