-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.py
40 lines (31 loc) · 1.06 KB
/
menu.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import sys
from multiprocessing import Process
import gi
from plaid.manager import PlaidManager
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GObject
class PlaidApp(Gtk.Application):
process: Process
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.manager = PlaidManager()
self.connect('activate', self.app_start)
image = Gtk.Image.new_from_file("./plaid.png")
image.set_pixel_size(24)
self.tray_icon = Gtk.StatusIcon.new_from_pixbuf(image.get_pixbuf())
self.tray_icon.set_tooltip_text("Plaid")
self.tray_icon.connect("activate", self.close_app)
self.process = Process(target=self.manager.RenderForever)
def close_app(self, data=None):
try:
self.process.terminate()
finally:
Gtk.main_quit()
sys.exit(0)
def app_start(self, app):
self.process.start()
if __name__ == '__main__':
GObject.threads_init()
app = PlaidApp(application_id="net.boundcorp.Plaid")
app.run(sys.argv)
Gtk.main()