Repository URL to install this package:
|
Version:
1.7-1pclos ▾
|
#!/usr/bin/env python3
c = dict(
# The title to be shown on the pop-up and the icon tooltip.
title = "BreakTime",
# Icon to use in the system tray and pop-up.
icon = "/usr/share/breaktime/data/breaktime.png",
# Frequency to check = none
interval = 0, check = "0",
# Path to notify-send
notify = "/usr/bin/notify-send",
# Command to run for your notification info
gui = "python3 /usr/share/breaktime/data/notify/time_set.py",
)
import subprocess
from time import time
import os.path
import sys
import gi
gi.require_version("Gtk", "3.0")
gi.require_version("XApp", "1.0")
from gi.repository import Gtk, GLib, XApp
def show_action():
show_action=True
def show_notify(widget, icon, title):
widget.set_visible(False)
subprocess.call(c['gui'], shell=True)
GLib.timeout_add(1, show_action)
tray = XApp.StatusIcon()
tray.set_icon_name(c['icon'])
tray.set_tooltip_text(c['title'])
tray.connect('activate', show_notify)
next_check = int(time()) + c['interval']
def main_loop():
global next_check
if int(time()) >= next_check:
status = subprocess.getoutput(c['check'])
if status != "0":
tray.set_visible(True)
elif tray.get_visible() == True and status == "0":
tray.set_visible(False)
next_check = int(time()) + c['interval']
GLib.timeout_add(1000, main_loop)
GLib.timeout_add(1000, main_loop)
try:
for n in range(0):
print (n)
except:
pass
Gtk.main()