Created
September 14, 2014 13:21
-
-
Save oktayacikalin/c31d48a89643ad0ec637 to your computer and use it in GitHub Desktop.
Gtk, Wnck Workspace switch notifier in Python http://pastebin.com/RVAsutaj
This file contains 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 characters
#!/usr/bin/env python3 | |
from gi.repository import Wnck, Gtk, Notify | |
import signal, time | |
class Kludge: | |
def __init__(self): | |
self.first = True | |
signal.signal(signal.SIGINT, signal.SIG_DFL) | |
self.screen = Wnck.Screen.get_default() | |
Notify.init("Workspace Switch Notifier") | |
def fire_the_kludge(self, data_a, data_b): | |
time.sleep(.1) | |
try: | |
workspace_num = str(self.screen.get_active_workspace().get_number()) | |
except: | |
workspace_num = "Some error happened" | |
popup = Notify.Notification.new("Workspace: " + workspace_num) | |
popup.show() | |
time.sleep(1) | |
popup.close() | |
def main(self): | |
self.screen.connect("active-workspace-changed", self.fire_the_kludge) | |
Gtk.main() | |
if __name__ == '__main__': | |
print("Here comes the kludge") | |
kludge = Kludge() | |
kludge.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
Where would you put this script ?