Guest User

Untitled

a guest
Jul 13th, 2014
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. from gi.repository import Wnck, Gtk, Notify
  4. import signal, time
  5.  
  6. class Kludge:
  7. def __init__(self):
  8. self.first = True
  9. signal.signal(signal.SIGINT, signal.SIG_DFL)
  10. self.screen = Wnck.Screen.get_default()
  11. Notify.init("Workspace Switch Notifier")
  12.  
  13. def fire_the_kludge(self, data_a, data_b):
  14. time.sleep(.1)
  15. try:
  16. workspace_num = str(self.screen.get_active_workspace().get_number())
  17. except:
  18. workspace_num = "Some error happened"
  19. popup = Notify.Notification.new("Workspace: " + workspace_num)
  20. popup.show()
  21. time.sleep(1)
  22. popup.close()
  23.  
  24. def main(self):
  25. self.screen.connect("active-workspace-changed", self.fire_the_kludge)
  26. Gtk.main()
  27.  
  28. if __name__ == '__main__':
  29. print("Here comes the kludge")
  30. kludge = Kludge()
  31. kludge.main()
Advertisement
Add Comment
Please, Sign In to add comment