Started migration to Python... Maybe not a good idea.
This commit is contained in:
parent
dee30e9c93
commit
8758aa2385
7 changed files with 237 additions and 3 deletions
45
spacetray.py
Executable file
45
spacetray.py
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2023 Johannes Findeisen <you@hanez.org>.
|
||||
#
|
||||
import gi
|
||||
import sys
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
gi.require_version('AppIndicator3', '0.1')
|
||||
from gi.repository import AppIndicator3
|
||||
|
||||
|
||||
def menuitem_response(w, buf):
|
||||
print(buf)
|
||||
|
||||
|
||||
def exit_app():
|
||||
sys.exit()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ind = AppIndicator3.Indicator.new("example-simple-client",
|
||||
"indicator-messages",
|
||||
AppIndicator3.IndicatorCategory.APPLICATION_STATUS)
|
||||
ind.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
|
||||
ind.set_attention_icon("indicator-messages-new")
|
||||
|
||||
# create a menu
|
||||
menu = Gtk.Menu()
|
||||
|
||||
# create some sub menus
|
||||
for i in range(3):
|
||||
buf = "Test-sub-menu - %d" % i
|
||||
menu_items = Gtk.MenuItem(buf)
|
||||
menu.append(menu_items)
|
||||
|
||||
# this is where you would connect your menu item up with a function:
|
||||
menu_items.connect("activate", menuitem_response, buf)
|
||||
|
||||
# show the items
|
||||
menu_items.show()
|
||||
|
||||
ind.set_menu(menu)
|
||||
|
||||
Gtk.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue