Using is again simple: save the source to some file (lets say skype-toggle.py), make it executable (chmod 755 skype-toggle.py) and add a hotkey to your window manager to run this script. That's all! :)
#!/usr/bin/env python import dbus import os remote_bus = dbus.SessionBus() out_connection = remote_bus.get_object('com.Skype.API', '/com/Skype') out_connection.Invoke('NAME SkypeToggler') out_connection.Invoke('PROTOCOL 5') wnd_state = out_connection.Invoke('GET WINDOWSTATE') if 'WINDOWSTATE NORMAL' == wnd_state: print 'Hide' out_connection.Invoke('MINIMIZE') elif 'WINDOWSTATE HIDDEN' == wnd_state: print 'Show' out_connection.Invoke('FOCUS') wId = os.popen('wmctrl -lp | grep Skype | sort -n | head -n 1 | awk "{print $1}"').read() print wId os.system('wmctrl -ia ' + wId)
No comments:
Post a Comment