#!/usr/bin/env python3

import os
from PIL import Image
import pystray


png_file = "/usr/share/breaktime/data/breaktime.png"

# Load the image
image = Image.open(png_file)

def script1():
    os.popen("pkill -f /usr/share/breaktime/data/notify/BreakTime & pkill -SIGKILL breaktime > /dev/null 2>&1")

def script2():
    os.popen("python3 /usr/share/breaktime/data/notify/Breaktime")

def script3():
    os.popen("pkill -f /usr/share/breaktime/data/notify/BreakTime & rm -f /tmp/tmp* > /dev/null 2>&1")

# Create a tray icon with mouse-over description
menu_items = [
    pystray.MenuItem("Stop", script1),
    pystray.MenuItem("About", script2),    
    pystray.MenuItem("Quit", script3)
]

icon = pystray.Icon("breaktime", image, menu=pystray.Menu(*menu_items), hover_text="BreakTime")
icon.run()


