-
Notifications
You must be signed in to change notification settings - Fork 3
/
appindicator.py
38 lines (32 loc) · 1023 Bytes
/
appindicator.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
import signal
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('AppIndicator3', '0.1')
from gi.repository import Gtk as gtk
from gi.repository import AppIndicator3 as appindicator
from pasw import PastWindow, key_listen
ctrl , alt, f = False, False, False
APPINDICATOR_ID = 'Snipaste'
def main():
indicator = appindicator.Indicator.new(APPINDICATOR_ID, 'whatever', appindicator.IndicatorCategory.SYSTEM_SERVICES)
indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
indicator.set_menu(build_menu())
gtk.main()
def build_menu():
menu = gtk.Menu()
# item_cap = gtk.MenuItem("截图")
# item_cap.connect("activate", capture)
# menu.append(item_cap)
item_quit = gtk.MenuItem('退出')
item_quit.connect('activate', quit)
menu.append(item_quit)
menu.show_all()
return menu
def capture(source):
PastWindow()
def quit(source):
gtk.main_quit()
if __name__ == "__main__":
signal.signal(signal.SIGINT, signal.SIG_DFL)
key_listen()
main()