import PySimpleGUIQt as sg import webbrowser import subprocess # Destinations VIEW_ISSUES_URL = r'https://github.com/MikeTheWatchGuy/PySimpleGUI/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc' PULL_REQUEST_URL = r'https://github.com/MikeTheWatchGuy/PySimpleGUI/compare/master...Dev-latest' DISCORD = r"C:\Users\mike\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord.lnk" def system_tray(): menu_def = ['UNUSED', ['Discord', 'Chrome', 'Open Issues', 'Pull Request', 'Exit']] # tray = sg.SystemTray(menu=menu_def, filename='myicon.ico', tooltip='My System Tray Launcher') tray = sg.SystemTray(menu=menu_def, data_base64=logo, tooltip='My System Tray Launcher') # The Event Loop runs every 5000ms poll_frequncy = 5000 tray.ShowMessage('Starup', 'System tray launcher has started') while True: menu_item = tray.Read(timeout=poll_frequncy) if menu_item == 'Exit': break if menu_item == sg.EVENT_SYSTEM_TRAY_ICON_ACTIVATED: # TODO Insert code to get number of emails... this is a demo only... tray.ShowMessage('You clicked me', 'You have 18 new emails') elif menu_item.startswith('Chrome'): # The launches do work however webbrowser.open_new('http://') elif menu_item.startswith('Open'): webbrowser.open_new_tab(VIEW_ISSUES_URL) elif menu_item.startswith('Pull'): webbrowser.open_new_tab(PULL_REQUEST_URL) elif menu_item == 'Discord': sp = subprocess.Popen([DISCORD, ''], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) logo = b'AAABAAEAISAAAAEACACoCQAAFgAAACgAAAAhAAAAQAAAAAEACAAAAAAAgAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAmGkwAJlqMACaajEAm2syAJxsMgCdbTMAmWs0AJttNgCbbjYAnW00AJxuNwCdbjQAnm40AJ9vNQCfcDcAnnA4AJ9xOQCgcDUAoXE2AKJyNwCjczgAo3Q5AKR0OACmdToApnY6AKd2OgCidDwApHY9AKV2PgCodzsApng+AKh4OwCoeDwAqXk8AKp5PACqej0Aq3s+AKx7PgCtfD4Arnw/AKZ4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