Skip to content

Instantly share code, notes, and snippets.

@btaczala
Last active January 17, 2018 10:33
Show Gist options
  • Save btaczala/c741ad5d33afeea95933eb304a8b11de to your computer and use it in GitHub Desktop.
Save btaczala/c741ad5d33afeea95933eb304a8b11de to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from pydbus import SessionBus
import os
from subprocess import Popen, PIPE
from rofi import Rofi
r = Rofi()
bus = SessionBus()
purple = bus.get("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
blist = purple.PurpleBlistGetBuddies()
list = []
names = []
for buddy in blist:
list.append( (buddy, purple.PurpleBuddyGetAlias(buddy), purple.PurpleBuddyGetName(buddy)))
names.append(purple.PurpleBuddyGetAlias(buddy) )
index, key = r.select("contact: ", names)
print(key)
if key != -1:
print(list[index])
accout = purple.PurpleAccountsFindConnected('', '')
conversation = purple.PurpleConversationNew(1, accout, list[index][2])
output = Popen(['/usr/bin/bspc', 'desktop', 'im', '-f'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment