Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # update bar on dash icon bye stdin
- # ex: for i in {0..100};do echo "$i";sleep 0.3;done | ./$0
- import sys, time
- from gi.repository import Unity, Gio, GObject, Dbusmenu
- loop = GObject.MainLoop()
- launcher = Unity.LauncherEntry.get_for_desktop_id ("launcher.desktop")
- launcher.set_property("progress_visible", True)
- def update_line():
- line = sys.stdin.readline()
- while line :
- line = float(line) * .01
- launcher.set_property("progress", line)
- line = sys.stdin.readline()
- if len(line) == 0: # fin de ~"fichier"
- launcher.set_property("urgent", True)
- time.sleep(3)
- print "It's the end..."
- loop.quit()
- return True
- GObject.timeout_add_seconds(1, update_line)
- loop.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement