Showing posts with label Skype. Show all posts
Showing posts with label Skype. Show all posts

01 June 2011

Some more useful Skype scripts

I was going to write a script to mute\unmute Skype during a call, but I was unable to find DBus API documentation for Skype (I would be very pleased if you share a link or a document if you have one). Today I've found the script I need along with few more useful scripts:
All these stuff could be easily bound to a hotkey depending on environment you're using.
Happy Skyping :)

04 October 2009

Toggle Skype main window with keyboard

Here is another script I often use. It toggles visibility of Skype's window. The script is written in Python (I have just found most clear example of using D-Bus in Python) and relies on Skype supporting D-Bus remote API (OSS build of Skype does not support it). Other dependencies are python-dbus and wmctrl. Wmctrl is used to really give focus to Skype main window and to switch to the desktop where it is (BTW the script should work even without wmctrl installed, but may not bring up the main window to the top sometimes) and python-dbus is needed to send messages to Skype to show and hide it's main window.
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)