Hows to set Skype shortcut for opening existing instance?
I'm using Linux for about two years now, but due to my Windows legacy I like keeping icons on my desktop instead of docks, panel shortcuts, etc.
If Skype is already running, pressing the shortcut starts a new sequence rather than opening an existing one. This is kinda cool as you can have two accounts running. But I only have one.
So, my question is whether it is possible to tweak Skype into opening an already existent instance when pressing the shortcut?
Solution 1:
A user, jackwizard, over at the Skype forums found a workaround. His script is mirrored at github, and copied here for your convenience.
- Copy it into a file called skype-single-instance
- Make it executable.
chmod +x skype-single-instance
- Test it.
pkill -9 skype
, then./skype-single-instance
, then./skype-single-instance
- Make it available system-wide.
sudo cp skype-single-instance /usr/bin/
- Change your shortcuts to use it instead of the normal
skype
command.
.
#!/usr/bin/env python
import dbus
import sys
import os
try:
# Try and set skype window to normal
remote_bus = dbus.SessionBus()
out_connection = remote_bus.get_object('com.Skype.API', '/com/Skype')
out_connection.Invoke('NAME mySkypeController')
out_connection.Invoke('PROTOCOL 5')
#out_connection.Invoke('SET WINDOWSTATE MAXIMIZED')
out_connection.Invoke('SET WINDOWSTATE NORMAL')
out_connection.Invoke('FOCUS')
except:
os.system("skype")
sys.exit()