Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/env/ python
- # -*- coding:utf-8 -*-
- import os, pystray
- from pystray import MenuItem as item, Menu as menu
- from PIL import Image
- def action(menuitem=None):
- os.system("notify-send 'action is pressed'")
- pass
- def dummy(menuitem=None):
- if menuitem:
- os.system("echo got it: " + str(menuitem))
- os.system("notify-send 'iniciando SSH para: "+menuitem+"'")
- os.system("xfce4-terminal -e 'aruba'") ## esto funciona porque tengo creados alias para aruba, de lo contrario habría que indicar el comando ssh completo
- pass
- image = Image.open("icon.png")
- # fijate, un item para tener el label, y dentro el menu sin mas
- aruba = item('Submenu 1', menu(item('SSH aruba', lambda : dummy('aruba'))))
- siruelo = item('Submenu 2', menu(item('SSH siruelo', lambda : dummy('siruelo'))))
- menu = (aruba, siruelo)
- icon = pystray.Icon("name", image, "title", menu=menu)
- icon.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement