Last active
December 3, 2021 18:50
-
-
Save candidtim/5663cc76aa329b2ddfb5 to your computer and use it in GitHub Desktop.
Revisions
-
candidtim revised this gist
Sep 27, 2015 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ # This code is an example for a tutorial on Ubuntu Unity/Gnome AppIndicators: # http://candidtim.github.io/appindicator/2014/09/13/ubuntu-appindicator-step-by-step.html import os import signal import json -
candidtim revised this gist
Jun 24, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ import os import signal import json @@ -11,7 +12,7 @@ APPINDICATOR_ID = 'myappindicator' def main(): indicator = appindicator.Indicator.new(APPINDICATOR_ID, os.path.abspath('sample_icon.svg'), appindicator.IndicatorCategory.SYSTEM_SERVICES) indicator.set_status(appindicator.IndicatorStatus.ACTIVE) indicator.set_menu(build_menu()) notify.init(APPINDICATOR_ID) -
candidtim revised this gist
Feb 13, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ APPINDICATOR_ID = 'myappindicator' def main(): indicator = appindicator.Indicator.new(APPINDICATOR_ID, 'sample_icon.svg', appindicator.IndicatorCategory.SYSTEM_SERVICES) indicator.set_status(appindicator.IndicatorStatus.ACTIVE) indicator.set_menu(build_menu()) notify.init(APPINDICATOR_ID) -
candidtim created this gist
Feb 13, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ import signal import json from urllib2 import Request, urlopen, URLError from gi.repository import Gtk as gtk from gi.repository import AppIndicator3 as appindicator from gi.repository import Notify as notify APPINDICATOR_ID = 'myappindicator' def main(): indicator = appindicator.Indicator.new(APPINDICATOR_ID, '/home/tim/temp/sample_icon.svg', appindicator.IndicatorCategory.SYSTEM_SERVICES) indicator.set_status(appindicator.IndicatorStatus.ACTIVE) indicator.set_menu(build_menu()) notify.init(APPINDICATOR_ID) gtk.main() def build_menu(): menu = gtk.Menu() item_joke = gtk.MenuItem('Joke') item_joke.connect('activate', joke) menu.append(item_joke) item_quit = gtk.MenuItem('Quit') item_quit.connect('activate', quit) menu.append(item_quit) menu.show_all() return menu def fetch_joke(): request = Request('http://api.icndb.com/jokes/random?limitTo=[nerdy]') response = urlopen(request) joke = json.loads(response.read())['value']['joke'] return joke def joke(_): notify.Notification.new("<b>Joke</b>", fetch_joke(), None).show() def quit(_): notify.uninit() gtk.main_quit() if __name__ == "__main__": signal.signal(signal.SIGINT, signal.SIG_DFL) main()